mail: 'my' location is available as mail location
move the reserve domains check to app location validation code
This commit is contained in:
@@ -9,16 +9,32 @@ const apps = require('../apps.js'),
|
||||
AuditSource = require('../auditsource.js'),
|
||||
BoxError = require('../boxerror.js'),
|
||||
common = require('./common.js'),
|
||||
constants = require('../constants.js'),
|
||||
expect = require('expect.js'),
|
||||
safe = require('safetydance');
|
||||
|
||||
describe('Apps', function () {
|
||||
const { domainSetup, cleanup, app, admin, user } = common;
|
||||
const { domainSetup, cleanup, app, admin, user , domain } = common;
|
||||
|
||||
before(domainSetup);
|
||||
after(cleanup);
|
||||
|
||||
describe('validateLocations', function () {
|
||||
it('does not allow reserved subdomain', async function () {
|
||||
let location = { type: apps.LOCATION_TYPE_ALIAS, subdomain: 'my', domain: domain.domain };
|
||||
expect(await apps._validateLocations([location])).to.be.an(Error);
|
||||
});
|
||||
|
||||
it('does not allow unknown domain', async function () {
|
||||
let location = { type: apps.LOCATION_TYPE_PRIMARY, subdomain: 'my2', domain: domain.domain + 'x' };
|
||||
expect(await apps._validateLocations([location])).to.be.an(Error);
|
||||
});
|
||||
|
||||
it('allows valid locations', async function () {
|
||||
let location = { type: apps.LOCATION_TYPE_SECONDARY, subdomain: 'my2', domain: domain.domain };
|
||||
expect(await apps._validateLocations([location])).to.be(null);
|
||||
});
|
||||
});
|
||||
|
||||
describe('validatePortBindings', function () {
|
||||
it('does not allow invalid host port', function () {
|
||||
expect(apps._validatePortBindings({ port: -1 }, { tcpPorts: { port: 5000 } })).to.be.an(Error);
|
||||
|
||||
@@ -18,10 +18,6 @@ describe('DNS', function () {
|
||||
after(cleanup);
|
||||
|
||||
describe('validateHostname', function () {
|
||||
it('does not allow admin subdomain', function () {
|
||||
expect(dns.validateHostname('my', domain)).to.be.an(Error);
|
||||
});
|
||||
|
||||
it('cannot have >63 length subdomains', function () {
|
||||
const s = Array(64).fill('s').join('');
|
||||
expect(dns.validateHostname(s, domain)).to.be.an(Error);
|
||||
|
||||
Reference in New Issue
Block a user