Fix failing dns and network test
This commit is contained in:
@@ -14,7 +14,10 @@ var async = require('async'),
|
||||
domains = require('../domains.js'),
|
||||
expect = require('expect.js'),
|
||||
nock = require('nock'),
|
||||
util = require('util');
|
||||
querystring = require('querystring'),
|
||||
settings = require('../settings.js'),
|
||||
util = require('util'),
|
||||
_ = require('underscore');
|
||||
|
||||
var DOMAIN_0 = {
|
||||
domain: 'example-dns-test.com',
|
||||
@@ -33,6 +36,7 @@ describe('dns provider', function () {
|
||||
async.series([
|
||||
database.initialize,
|
||||
database._clear,
|
||||
settings.setAdminLocation.bind(null, DOMAIN_0.domain, 'my.' + DOMAIN_0.domain),
|
||||
domains.add.bind(null, DOMAIN_0.domain, DOMAIN_0, AUDIT_SOURCE)
|
||||
], done);
|
||||
});
|
||||
@@ -656,8 +660,8 @@ describe('dns provider', function () {
|
||||
})
|
||||
.reply(200, GET_HOSTS_RETURN);
|
||||
|
||||
var req2 = nock(NAMECHEAP_ENDPOINT).post('/xml.response')
|
||||
.query({
|
||||
var req2 = nock(NAMECHEAP_ENDPOINT).post('/xml.response', (body) => {
|
||||
const expected = {
|
||||
ApiUser: username,
|
||||
ApiKey: token,
|
||||
UserName: username,
|
||||
@@ -682,7 +686,9 @@ describe('dns provider', function () {
|
||||
HostName3: 'test',
|
||||
RecordType3: 'A',
|
||||
Address3: '1.2.3.4',
|
||||
})
|
||||
};
|
||||
return _.isEqual(body, expected);
|
||||
})
|
||||
.reply(200, SET_HOSTS_RETURN);
|
||||
|
||||
domains.upsertDnsRecords('test', DOMAIN_0.domain, 'A', ['1.2.3.4'], function (error) {
|
||||
@@ -723,8 +729,8 @@ describe('dns provider', function () {
|
||||
})
|
||||
.reply(200, GET_HOSTS_RETURN);
|
||||
|
||||
var req2 = nock(NAMECHEAP_ENDPOINT).post('/xml.response')
|
||||
.query({
|
||||
var req2 = nock(NAMECHEAP_ENDPOINT).post('/xml.response', (body) => {
|
||||
const expected = {
|
||||
ApiUser: username,
|
||||
ApiKey: token,
|
||||
UserName: username,
|
||||
@@ -759,7 +765,9 @@ describe('dns provider', function () {
|
||||
HostName5: 'test',
|
||||
RecordType5: 'TXT',
|
||||
Address5: '3.4.5.6',
|
||||
})
|
||||
};
|
||||
return _.isEqual(body, expected);
|
||||
})
|
||||
.reply(200, SET_HOSTS_RETURN);
|
||||
|
||||
domains.upsertDnsRecords('test', DOMAIN_0.domain, 'TXT', ['1.2.3.4', '2.3.4.5', '3.4.5.6'], function (error) {
|
||||
@@ -800,8 +808,8 @@ describe('dns provider', function () {
|
||||
})
|
||||
.reply(200, GET_HOSTS_RETURN);
|
||||
|
||||
var req2 = nock(NAMECHEAP_ENDPOINT).post('/xml.response')
|
||||
.query({
|
||||
var req2 = nock(NAMECHEAP_ENDPOINT).post('/xml.response', (body) => {
|
||||
const expected = {
|
||||
ApiUser: username,
|
||||
ApiKey: token,
|
||||
UserName: username,
|
||||
@@ -821,7 +829,9 @@ describe('dns provider', function () {
|
||||
HostName2: 'www',
|
||||
RecordType2: 'CNAME',
|
||||
Address2: '1.2.3.4'
|
||||
})
|
||||
};
|
||||
return _.isEqual(body, expected);
|
||||
})
|
||||
.reply(200, SET_HOSTS_RETURN);
|
||||
|
||||
domains.upsertDnsRecords('www', DOMAIN_0.domain, 'CNAME', ['1.2.3.4'], function (error) {
|
||||
@@ -903,9 +913,31 @@ describe('dns provider', function () {
|
||||
})
|
||||
.reply(200, GET_HOSTS_RETURN);
|
||||
|
||||
var req2 = nock(NAMECHEAP_ENDPOINT).post('/xml.response', (body) => {
|
||||
const expected = {
|
||||
ApiUser: username,
|
||||
ApiKey: token,
|
||||
UserName: username,
|
||||
ClientIp: '127.0.0.1',
|
||||
Command: 'namecheap.domains.dns.setHosts',
|
||||
SLD: DOMAIN_0.zoneName.split('.')[0],
|
||||
TLD: DOMAIN_0.zoneName.split('.')[1],
|
||||
|
||||
TTL1: '300',
|
||||
HostName1: '@',
|
||||
RecordType1: 'MX',
|
||||
Address1: 'my.nebulon.space.',
|
||||
EmailType1: 'MX',
|
||||
MXPref1: '10',
|
||||
};
|
||||
return _.isEqual(body, expected);
|
||||
})
|
||||
.reply(200, SET_HOSTS_RETURN);
|
||||
|
||||
domains.removeDnsRecords('www', DOMAIN_0.domain, 'CNAME', ['1.2.3.4'], function (error) {
|
||||
expect(error).to.eql(null);
|
||||
expect(req1.isDone()).to.be.ok();
|
||||
expect(req2.isDone()).to.be.ok();
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user