settings: move mailFqdn/Domain into mailServer
This commit is contained in:
@@ -13,7 +13,7 @@ const common = require('./common.js'),
|
||||
_ = require('underscore');
|
||||
|
||||
describe('Mail API', function () {
|
||||
const { setup, cleanup, serverUrl, owner, dashboardDomain } = common;
|
||||
const { setup, cleanup, serverUrl, owner, dashboardDomain, mailFqdn } = common;
|
||||
|
||||
let publicKey;
|
||||
before(async () => {
|
||||
@@ -136,13 +136,13 @@ describe('Mail API', function () {
|
||||
expect(response.body.dns.mx).to.be.an('object');
|
||||
expect(response.body.dns.mx.type).to.eql('MX');
|
||||
expect(response.body.dns.mx.value).to.eql(null);
|
||||
expect(response.body.dns.mx.expected).to.eql('10 ' + settings.mailFqdn() + '.');
|
||||
expect(response.body.dns.mx.expected).to.eql('10 ' + mailFqdn + '.');
|
||||
expect(response.body.dns.mx.status).to.eql(false);
|
||||
|
||||
expect(response.body.dns.ptr).to.be.an('object');
|
||||
expect(response.body.dns.ptr.type).to.eql('PTR');
|
||||
// expect(response.body.ptr.value).to.eql(null); this will be anything random
|
||||
expect(response.body.dns.ptr.expected).to.eql(settings.mailFqdn());
|
||||
expect(response.body.dns.ptr.expected).to.eql(mailFqdn);
|
||||
expect(response.body.dns.ptr.status).to.eql(false);
|
||||
});
|
||||
|
||||
@@ -176,11 +176,11 @@ describe('Mail API', function () {
|
||||
|
||||
expect(response.body.dns.mx).to.be.an('object');
|
||||
expect(response.body.dns.mx.status).to.eql(false);
|
||||
expect(response.body.dns.mx.expected).to.eql('10 ' + settings.mailFqdn() + '.');
|
||||
expect(response.body.dns.mx.expected).to.eql('10 ' + mailFqdn + '.');
|
||||
expect(response.body.dns.mx.value).to.eql(null);
|
||||
|
||||
expect(response.body.dns.ptr).to.be.an('object');
|
||||
expect(response.body.dns.ptr.expected).to.eql(settings.mailFqdn());
|
||||
expect(response.body.dns.ptr.expected).to.eql(mailFqdn);
|
||||
expect(response.body.dns.ptr.status).to.eql(false);
|
||||
// expect(response.body.ptr.value).to.eql(null); this will be anything random
|
||||
});
|
||||
@@ -188,7 +188,7 @@ describe('Mail API', function () {
|
||||
it('succeeds with all different spf, dkim, dmarc, mx, ptr records', async function () {
|
||||
clearDnsAnswerQueue();
|
||||
|
||||
dnsAnswerQueue[mxDomain].MX = [ { priority: '20', exchange: settings.mailFqdn() }, { priority: '10', exchange: 'some.other.server' } ];
|
||||
dnsAnswerQueue[mxDomain].MX = [ { priority: '20', exchange: mailFqdn }, { priority: '10', exchange: 'some.other.server' } ];
|
||||
dnsAnswerQueue[dmarcDomain].TXT = [['v=DMARC2; p=reject; pct=100']];
|
||||
dnsAnswerQueue[dkimDomain].TXT = [['v=DKIM2; t=s; p=' + publicKey]];
|
||||
dnsAnswerQueue[spfDomain].TXT = [['v=spf1 a:random.com ~all']];
|
||||
@@ -215,11 +215,11 @@ describe('Mail API', function () {
|
||||
|
||||
expect(response.body.dns.mx).to.be.an('object');
|
||||
expect(response.body.dns.mx.status).to.eql(true);
|
||||
expect(response.body.dns.mx.expected).to.eql('10 ' + settings.mailFqdn() + '.');
|
||||
expect(response.body.dns.mx.value).to.eql('20 ' + settings.mailFqdn() + '. 10 some.other.server.');
|
||||
expect(response.body.dns.mx.expected).to.eql('10 ' + mailFqdn + '.');
|
||||
expect(response.body.dns.mx.value).to.eql('20 ' + mailFqdn + '. 10 some.other.server.');
|
||||
|
||||
expect(response.body.dns.ptr).to.be.an('object');
|
||||
expect(response.body.dns.ptr.expected).to.eql(settings.mailFqdn());
|
||||
expect(response.body.dns.ptr.expected).to.eql(mailFqdn);
|
||||
expect(response.body.dns.ptr.status).to.eql(false);
|
||||
// expect(response.body.ptr.value).to.eql(null); this will be anything random
|
||||
|
||||
@@ -229,7 +229,7 @@ describe('Mail API', function () {
|
||||
it('succeeds with existing embedded spf', async function () {
|
||||
clearDnsAnswerQueue();
|
||||
|
||||
dnsAnswerQueue[spfDomain].TXT = [['v=spf1 a:example.com a:' + settings.mailFqdn() + ' ~all']];
|
||||
dnsAnswerQueue[spfDomain].TXT = [['v=spf1 a:example.com a:' + mailFqdn + ' ~all']];
|
||||
|
||||
const response = await superagent.get(`${serverUrl}/api/v1/mail/${dashboardDomain}/status`)
|
||||
.query({ access_token: owner.token });
|
||||
@@ -239,8 +239,8 @@ describe('Mail API', function () {
|
||||
expect(response.body.dns.spf).to.be.an('object');
|
||||
expect(response.body.dns.spf.domain).to.eql(spfDomain);
|
||||
expect(response.body.dns.spf.type).to.eql('TXT');
|
||||
expect(response.body.dns.spf.value).to.eql('v=spf1 a:example.com a:' + settings.mailFqdn() + ' ~all');
|
||||
expect(response.body.dns.spf.expected).to.eql('v=spf1 a:example.com a:' + settings.mailFqdn() + ' ~all');
|
||||
expect(response.body.dns.spf.value).to.eql('v=spf1 a:example.com a:' + mailFqdn + ' ~all');
|
||||
expect(response.body.dns.spf.expected).to.eql('v=spf1 a:example.com a:' + mailFqdn + ' ~all');
|
||||
expect(response.body.dns.spf.status).to.eql(true);
|
||||
});
|
||||
|
||||
@@ -263,7 +263,7 @@ describe('Mail API', function () {
|
||||
it('succeeds with all correct records', async function () {
|
||||
clearDnsAnswerQueue();
|
||||
|
||||
dnsAnswerQueue[mxDomain].MX = [ { priority: '10', exchange: settings.mailFqdn() } ];
|
||||
dnsAnswerQueue[mxDomain].MX = [ { priority: '10', exchange: mailFqdn } ];
|
||||
dnsAnswerQueue[dmarcDomain].TXT = [['v=DMARC1; p=reject; pct=100']];
|
||||
dnsAnswerQueue[dkimDomain].TXT = [['v=DKIM1; t=s; p=', publicKey ]];
|
||||
dnsAnswerQueue[spfDomain].TXT = [['v=spf1 a:' + settings.dashboardFqdn() + ' ~all']];
|
||||
@@ -294,8 +294,8 @@ describe('Mail API', function () {
|
||||
|
||||
expect(response.body.dns.mx).to.be.an('object');
|
||||
expect(response.body.dns.mx.status).to.eql(true);
|
||||
expect(response.body.dns.mx.expected).to.eql('10 ' + settings.mailFqdn() + '.');
|
||||
expect(response.body.dns.mx.value).to.eql('10 ' + settings.mailFqdn() + '.');
|
||||
expect(response.body.dns.mx.expected).to.eql('10 ' + mailFqdn + '.');
|
||||
expect(response.body.dns.mx.value).to.eql('10 ' + mailFqdn + '.');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user