Migrate dns test to domains.js
This commit is contained in:
@@ -14,7 +14,7 @@ var async = require('async'),
|
||||
expect = require('expect.js'),
|
||||
nock = require('nock'),
|
||||
settings = require('../settings.js'),
|
||||
subdomains = require('../subdomains.js'),
|
||||
domains = require('../domains.js'),
|
||||
util = require('util');
|
||||
|
||||
describe('dns provider', function () {
|
||||
@@ -44,7 +44,7 @@ describe('dns provider', function () {
|
||||
});
|
||||
|
||||
it('upsert succeeds', function (done) {
|
||||
subdomains.upsert('test', 'A', [ '1.2.3.4' ], function (error, result) {
|
||||
domains.upsertDNSRecords('test.example.com', 'A', [ '1.2.3.4' ], function (error, result) {
|
||||
expect(error).to.eql(null);
|
||||
expect(result).to.eql('noop-record-id');
|
||||
|
||||
@@ -53,7 +53,7 @@ describe('dns provider', function () {
|
||||
});
|
||||
|
||||
it('get succeeds', function (done) {
|
||||
subdomains.get('test', 'A', function (error, result) {
|
||||
domains.getDNSRecords('test.example.com', 'A', function (error, result) {
|
||||
expect(error).to.eql(null);
|
||||
expect(result).to.be.an(Array);
|
||||
expect(result.length).to.eql(0);
|
||||
@@ -63,7 +63,7 @@ describe('dns provider', function () {
|
||||
});
|
||||
|
||||
it('del succeeds', function (done) {
|
||||
subdomains.remove('test', 'A', [ '1.2.3.4' ], function (error) {
|
||||
domains.removeDNSRecords('test.example.com', 'A', [ '1.2.3.4' ], function (error) {
|
||||
expect(error).to.eql(null);
|
||||
|
||||
done();
|
||||
@@ -107,7 +107,7 @@ describe('dns provider', function () {
|
||||
.post('/v2/domains/' + config.zoneName() + '/records')
|
||||
.reply(201, { domain_record: DOMAIN_RECORD_0 });
|
||||
|
||||
subdomains.upsert('test', 'A', [ '1.2.3.4' ], function (error, result) {
|
||||
domains.upsertDNSRecords('test.example.com', 'A', [ '1.2.3.4' ], function (error, result) {
|
||||
expect(error).to.eql(null);
|
||||
expect(result).to.eql('3352892');
|
||||
expect(req1.isDone()).to.be.ok();
|
||||
@@ -157,7 +157,7 @@ describe('dns provider', function () {
|
||||
.put('/v2/domains/' + config.zoneName() + '/records/' + DOMAIN_RECORD_1.id)
|
||||
.reply(200, { domain_record: DOMAIN_RECORD_1_NEW });
|
||||
|
||||
subdomains.upsert('test', 'A', [ DOMAIN_RECORD_1_NEW.data ], function (error, result) {
|
||||
domains.upsertDNSRecords('test.example.com', 'A', [ DOMAIN_RECORD_1_NEW.data ], function (error, result) {
|
||||
expect(error).to.eql(null);
|
||||
expect(result).to.eql('3352893');
|
||||
expect(req1.isDone()).to.be.ok();
|
||||
@@ -243,7 +243,7 @@ describe('dns provider', function () {
|
||||
.post('/v2/domains/' + config.zoneName() + '/records')
|
||||
.reply(201, { domain_record: DOMAIN_RECORD_2_NEW });
|
||||
|
||||
subdomains.upsert('', 'TXT', [ DOMAIN_RECORD_2_NEW.data, DOMAIN_RECORD_1_NEW.data, DOMAIN_RECORD_3_NEW.data ], function (error, result) {
|
||||
domains.upsertDNSRecords(config.fqdn(), 'TXT', [ DOMAIN_RECORD_2_NEW.data, DOMAIN_RECORD_1_NEW.data, DOMAIN_RECORD_3_NEW.data ], function (error, result) {
|
||||
expect(error).to.eql(null);
|
||||
expect(result).to.eql('3352893');
|
||||
expect(req1.isDone()).to.be.ok();
|
||||
@@ -282,7 +282,7 @@ describe('dns provider', function () {
|
||||
.get('/v2/domains/' + config.zoneName() + '/records')
|
||||
.reply(200, { domain_records: [ DOMAIN_RECORD_0, DOMAIN_RECORD_1 ] });
|
||||
|
||||
subdomains.get('test', 'A', function (error, result) {
|
||||
domains.getDNSRecords('test.example.com', 'A', function (error, result) {
|
||||
expect(error).to.eql(null);
|
||||
expect(result).to.be.an(Array);
|
||||
expect(result.length).to.eql(1);
|
||||
@@ -323,7 +323,7 @@ describe('dns provider', function () {
|
||||
.delete('/v2/domains/' + config.zoneName() + '/records/' + DOMAIN_RECORD_1.id)
|
||||
.reply(204, {});
|
||||
|
||||
subdomains.remove('test', 'A', ['1.2.3.4'], function (error) {
|
||||
domains.removeDNSRecords('test.example.com', 'A', ['1.2.3.4'], function (error) {
|
||||
expect(error).to.eql(null);
|
||||
expect(req1.isDone()).to.be.ok();
|
||||
expect(req2.isDone()).to.be.ok();
|
||||
@@ -430,7 +430,7 @@ describe('dns provider', function () {
|
||||
}
|
||||
}]);
|
||||
|
||||
subdomains.upsert('test', 'A', [ '1.2.3.4' ], function (error, result) {
|
||||
domains.upsertDNSRecords('test.example.com', 'A', [ '1.2.3.4' ], function (error, result) {
|
||||
expect(error).to.eql(null);
|
||||
expect(result).to.eql('/change/C2QLKQIWEI0BZF');
|
||||
expect(awsAnswerQueue.length).to.eql(0);
|
||||
@@ -449,7 +449,7 @@ describe('dns provider', function () {
|
||||
}
|
||||
}]);
|
||||
|
||||
subdomains.upsert('test', 'A', [ '1.2.3.4' ], function (error, result) {
|
||||
domains.upsertDNSRecords('test.example.com', 'A', [ '1.2.3.4' ], function (error, result) {
|
||||
expect(error).to.eql(null);
|
||||
expect(result).to.eql('/change/C2QLKQIWEI0BZF');
|
||||
expect(awsAnswerQueue.length).to.eql(0);
|
||||
@@ -468,7 +468,7 @@ describe('dns provider', function () {
|
||||
}
|
||||
}]);
|
||||
|
||||
subdomains.upsert('', 'TXT', [ 'first', 'second', 'third' ], function (error, result) {
|
||||
domains.upsertDNSRecords(config.fqdn(), 'TXT', [ 'first', 'second', 'third' ], function (error, result) {
|
||||
expect(error).to.eql(null);
|
||||
expect(result).to.eql('/change/C2QLKQIWEI0BZF');
|
||||
expect(awsAnswerQueue.length).to.eql(0);
|
||||
@@ -489,7 +489,7 @@ describe('dns provider', function () {
|
||||
}]
|
||||
}]);
|
||||
|
||||
subdomains.get('test', 'A', function (error, result) {
|
||||
domains.getDNSRecords('test.example.com', 'A', function (error, result) {
|
||||
expect(error).to.eql(null);
|
||||
expect(result).to.be.an(Array);
|
||||
expect(result.length).to.eql(1);
|
||||
@@ -510,7 +510,7 @@ describe('dns provider', function () {
|
||||
}
|
||||
}]);
|
||||
|
||||
subdomains.remove('test', 'A', ['1.2.3.4'], function (error) {
|
||||
domains.removeDNSRecords('test.example.com', 'A', ['1.2.3.4'], function (error) {
|
||||
expect(error).to.eql(null);
|
||||
expect(awsAnswerQueue.length).to.eql(0);
|
||||
|
||||
@@ -583,7 +583,8 @@ describe('dns provider', function () {
|
||||
zoneQueue.push([null, HOSTED_ZONES]); // getZone
|
||||
zoneQueue.push([null, [ ]]); // getRecords
|
||||
zoneQueue.push([null, {id: '1'}]);
|
||||
subdomains.upsert('test', 'A', [ '1.2.3.4' ], function (error, result) {
|
||||
|
||||
domains.upsertDNSRecords('test.example.com', 'A', [ '1.2.3.4' ], function (error, result) {
|
||||
expect(error).to.eql(null);
|
||||
expect(result).to.eql('1');
|
||||
expect(zoneQueue.length).to.eql(0);
|
||||
@@ -597,7 +598,7 @@ describe('dns provider', function () {
|
||||
zoneQueue.push([null, [GCDNS().zone('test').record('A', {'name': 'test', data:['5.6.7.8'], ttl: 1})]]);
|
||||
zoneQueue.push([null, {id: '2'}]);
|
||||
|
||||
subdomains.upsert('test', 'A', [ '1.2.3.4' ], function (error, result) {
|
||||
domains.upsertDNSRecords('test.example.com', 'A', [ '1.2.3.4' ], function (error, result) {
|
||||
expect(error).to.eql(null);
|
||||
expect(result).to.eql('2');
|
||||
expect(zoneQueue.length).to.eql(0);
|
||||
@@ -611,7 +612,7 @@ describe('dns provider', function () {
|
||||
zoneQueue.push([null, [ ]]); // getRecords
|
||||
zoneQueue.push([null, {id: '3'}]);
|
||||
|
||||
subdomains.upsert('', 'TXT', [ 'first', 'second', 'third' ], function (error, result) {
|
||||
domains.upsertDNSRecords(config.fqdn(), 'TXT', [ 'first', 'second', 'third' ], function (error, result) {
|
||||
expect(error).to.eql(null);
|
||||
expect(result).to.eql('3');
|
||||
expect(zoneQueue.length).to.eql(0);
|
||||
@@ -624,7 +625,7 @@ describe('dns provider', function () {
|
||||
zoneQueue.push([null, HOSTED_ZONES]);
|
||||
zoneQueue.push([null, [GCDNS().zone('test').record('A', {'name': 'test', data:['1.2.3.4', '5.6.7.8'], ttl: 1})]]);
|
||||
|
||||
subdomains.get('test', 'A', function (error, result) {
|
||||
domains.getDNSRecords('test.example.com', 'A', function (error, result) {
|
||||
expect(error).to.eql(null);
|
||||
expect(result).to.be.an(Array);
|
||||
expect(result.length).to.eql(2);
|
||||
@@ -640,7 +641,7 @@ describe('dns provider', function () {
|
||||
zoneQueue.push([null, [GCDNS().zone('test').record('A', {'name': 'test', data:['5.6.7.8'], ttl: 1})]]);
|
||||
zoneQueue.push([null, {id: '5'}]);
|
||||
|
||||
subdomains.remove('test', 'A', ['1.2.3.4'], function (error) {
|
||||
domains.removeDNSRecords('test.example.com', 'A', ['1.2.3.4'], function (error) {
|
||||
expect(error).to.eql(null);
|
||||
expect(zoneQueue.length).to.eql(0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user