more config.fqdn() removal in tests

This commit is contained in:
Girish Ramakrishnan
2018-01-24 14:58:37 -08:00
parent 45456f2cf7
commit ee66893875
10 changed files with 47 additions and 73 deletions

View File

@@ -13,19 +13,19 @@ var appdb = require('../../appdb.js'),
nock = require('nock'),
superagent = require('superagent'),
server = require('../../server.js'),
settings = require('../../settings.js'),
settingsdb = require('../../settingsdb.js');
settings = require('../../settings.js');
var SERVER_URL = 'http://localhost:' + config.get('port');
var USERNAME = 'superadmin', PASSWORD = 'Foobar?1337', EMAIL ='silly@me.com';
var DOMAIN = 'example-backups-test.com';
var token = null;
function setup(done) {
nock.cleanAll();
config._reset();
config.setVersion('1.2.3');
config.setFqdn('example-backups-test.com');
config.setFqdn(DOMAIN);
async.series([
server.start.bind(server),
@@ -49,7 +49,7 @@ function setup(done) {
function addApp(callback) {
var manifest = { version: '0.0.1', manifestVersion: 1, dockerImage: 'foo', healthCheckPath: '/', httpPort: 3, title: 'ok', addons: { } };
appdb.add('appid', 'appStoreId', manifest, 'location', config.fqdn(), [ ] /* portBindings */, { }, callback);
appdb.add('appid', 'appStoreId', manifest, 'location', DOMAIN, [ ] /* portBindings */, { }, callback);
},
function createSettings(callback) {

View File

@@ -24,7 +24,7 @@ var SERVER_URL = 'http://localhost:' + config.get('port');
var USERNAME = 'superadmin', PASSWORD = 'Foobar?1337', EMAIL ='silly@me.com';
var token = null;
var DOMAIN = 'example-backups-test.com';
var gSudoOriginal = null;
function injectShellMock() {
@@ -41,7 +41,7 @@ function setup(done) {
config._reset();
config.set('provider', 'caas');
config.setVersion('1.2.3');
config.setFqdn('example-backups-test.com');
config.setFqdn(DOMAIN);
async.series([
server.start.bind(server),
@@ -72,7 +72,7 @@ function setup(done) {
function addApp(callback) {
var manifest = { version: '0.0.1', manifestVersion: 1, dockerImage: 'foo', healthCheckPath: '/', httpPort: 3, title: 'ok', addons: { } };
appdb.add('appid', 'appStoreId', manifest, 'location', config.fqdn(), [ ] /* portBindings */, { }, callback);
appdb.add('appid', 'appStoreId', manifest, 'location', DOMAIN, [ ] /* portBindings */, { }, callback);
},
function createSettings(callback) {
@@ -149,7 +149,6 @@ describe('Caas', function () {
expect(result.statusCode).to.equal(200);
expect(result.body.apiServerOrigin).to.eql('http://localhost:6060');
expect(result.body.webServerOrigin).to.eql(null);
expect(result.body.fqdn).to.eql(config.fqdn());
expect(result.body.adminFqdn).to.eql(config.adminFqdn());
expect(result.body.progress).to.be.an('object');
expect(result.body.update).to.be.an('object');

View File

@@ -189,7 +189,6 @@ describe('Cloudron', function () {
expect(result.statusCode).to.equal(200);
expect(result.body.apiServerOrigin).to.eql('http://localhost:6060');
expect(result.body.webServerOrigin).to.eql(null);
expect(result.body.fqdn).to.eql(config.fqdn());
expect(result.body.adminFqdn).to.eql(config.adminFqdn());
expect(result.body.progress).to.be.an('object');
expect(result.body.update).to.be.an('object');
@@ -211,7 +210,6 @@ describe('Cloudron', function () {
expect(result.body.apiServerOrigin).to.eql('http://localhost:6060');
expect(result.body.webServerOrigin).to.eql(null);
expect(result.body.fqdn).to.eql(config.fqdn());
expect(result.body.adminFqdn).to.eql(config.adminFqdn());
expect(result.body.progress).to.be.an('object');
expect(result.body.version).to.eql(config.version());

View File

@@ -16,6 +16,7 @@ var SERVER_URL = 'http://localhost:' + config.get('port');
var USERNAME = 'superadmin', PASSWORD = 'Foobar?1337', EMAIL ='silly@me.com';
var token = null;
var DOMAIN = 'example-domains-test.com';
var DOMAIN_0 = {
domain: 'cloudron.com',
@@ -35,7 +36,7 @@ describe('Domains API', function () {
before(function (done) {
config._reset();
config.setFqdn('example-domains-test.com');
config.setFqdn(DOMAIN);
async.series([
server.start.bind(null),
@@ -140,11 +141,10 @@ describe('Domains API', function () {
.end(function (error, result) {
expect(result.statusCode).to.equal(200);
expect(result.body.domains).to.be.an(Array);
// includes currently the implicitly added config.fqdn()
expect(result.body.domains.length).to.equal(3);
expect(result.body.domains[0].domain).to.equal(DOMAIN_0.domain);
expect(result.body.domains[1].domain).to.equal(config.fqdn());
expect(result.body.domains[1].domain).to.equal(DOMAIN);
expect(result.body.domains[2].domain).to.equal(DOMAIN_1.domain);
done();

View File

@@ -27,10 +27,11 @@ var appdb = require('../../appdb.js'),
var SERVER_URL = 'http://localhost:' + config.get('port');
var USERNAME = 'superadmin', PASSWORD = 'Foobar?1337', EMAIL ='silly@me.com';
var DOMAIN = 'example-sysadmin-test.com';
function setup(done) {
config._reset();
config.setFqdn('example-sysadmin-test.com');
config.setFqdn(DOMAIN);
config.setVersion('1.2.3');
async.series([
@@ -52,7 +53,7 @@ function setup(done) {
function addApp(callback) {
var manifest = { version: '0.0.1', manifestVersion: 1, dockerImage: 'foo', healthCheckPath: '/', httpPort: 3, title: 'ok', addons: { } };
appdb.add('appid', 'appStoreId', manifest, 'location', config.fqdn(), [ ] /* portBindings */, { }, callback);
appdb.add('appid', 'appStoreId', manifest, 'location', DOMAIN, [ ] /* portBindings */, { }, callback);
},
function createSettings(callback) {
@@ -61,7 +62,7 @@ function setup(done) {
s3._mockInject(MockS3);
safe.fs.mkdirSync('/tmp/box-sysadmin-test');
settingsdb.set(settings.BACKUP_CONFIG_KEY, JSON.stringify({ provider: 'caas', token: 'BACKUP_TOKEN', fqdn: config.fqdn(), key: 'key', prefix: 'boxid', format: 'tgz'}), callback);
settingsdb.set(settings.BACKUP_CONFIG_KEY, JSON.stringify({ provider: 'caas', token: 'BACKUP_TOKEN', fqdn: DOMAIN, key: 'key', prefix: 'boxid', format: 'tgz'}), callback);
}
], done);
}