settings: move externaldap setting
This commit is contained in:
@@ -14,7 +14,6 @@ const async = require('async'),
|
||||
ldap = require('ldapjs'),
|
||||
safe = require('safetydance'),
|
||||
server = require('../server.js'),
|
||||
settings = require('../settings.js'),
|
||||
superagent = require('superagent'),
|
||||
users = require('../users.js');
|
||||
|
||||
@@ -195,7 +194,7 @@ describe('External LDAP', function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
delete conf.url;
|
||||
|
||||
const [error] = await safe(settings.setExternalLdapConfig(conf));
|
||||
const [error] = await safe(externalLdap.setConfig(conf));
|
||||
expect(error.reason).to.equal(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
@@ -203,7 +202,7 @@ describe('External LDAP', function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.url = '';
|
||||
|
||||
const [error] = await safe(settings.setExternalLdapConfig(conf));
|
||||
const [error] = await safe(externalLdap.setConfig(conf));
|
||||
expect(error.reason).to.equal(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
@@ -211,7 +210,7 @@ describe('External LDAP', function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
delete conf.baseDn;
|
||||
|
||||
const [error] = await safe(settings.setExternalLdapConfig(conf));
|
||||
const [error] = await safe(externalLdap.setConfig(conf));
|
||||
expect(error.reason).to.equal(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
@@ -219,7 +218,7 @@ describe('External LDAP', function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.baseDn = '';
|
||||
|
||||
const [error] = await safe(settings.setExternalLdapConfig(conf));
|
||||
const [error] = await safe(externalLdap.setConfig(conf));
|
||||
expect(error.reason).to.equal(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
@@ -227,7 +226,7 @@ describe('External LDAP', function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
delete conf.filter;
|
||||
|
||||
const [error] = await safe(settings.setExternalLdapConfig(conf));
|
||||
const [error] = await safe(externalLdap.setConfig(conf));
|
||||
expect(error.reason).to.equal(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
@@ -235,16 +234,16 @@ describe('External LDAP', function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.filter = '';
|
||||
|
||||
const [error] = await safe(settings.setExternalLdapConfig(conf));
|
||||
const [error] = await safe(externalLdap.setConfig(conf));
|
||||
expect(error.reason).to.equal(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
it('enabling succeeds', async function () {
|
||||
await settings.setExternalLdapConfig(LDAP_CONFIG);
|
||||
await externalLdap.setConfig(LDAP_CONFIG);
|
||||
});
|
||||
|
||||
it('disabling succeeds', async function () {
|
||||
await settings.setExternalLdapConfig({ provider: 'noop' });
|
||||
await externalLdap.setConfig({ provider: 'noop' });
|
||||
});
|
||||
|
||||
// now test with groups
|
||||
@@ -253,7 +252,7 @@ describe('External LDAP', function () {
|
||||
conf.syncGroups = true;
|
||||
delete conf.groupBaseDn;
|
||||
|
||||
const [error] = await safe(settings.setExternalLdapConfig(conf));
|
||||
const [error] = await safe(externalLdap.setConfig(conf));
|
||||
expect(error.reason).to.equal(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
@@ -262,7 +261,7 @@ describe('External LDAP', function () {
|
||||
conf.syncGroups = true;
|
||||
conf.groupBaseDn = '';
|
||||
|
||||
const [error] = await safe(settings.setExternalLdapConfig(conf));
|
||||
const [error] = await safe(externalLdap.setConfig(conf));
|
||||
expect(error.reason).to.equal(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
@@ -271,7 +270,7 @@ describe('External LDAP', function () {
|
||||
conf.syncGroups = true;
|
||||
delete conf.groupFilter;
|
||||
|
||||
const [error] = await safe(settings.setExternalLdapConfig(conf));
|
||||
const [error] = await safe(externalLdap.setConfig(conf));
|
||||
expect(error.reason).to.equal(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
@@ -280,7 +279,7 @@ describe('External LDAP', function () {
|
||||
conf.syncGroups = true;
|
||||
conf.groupFilter = '';
|
||||
|
||||
const [error] = await safe(settings.setExternalLdapConfig(conf));
|
||||
const [error] = await safe(externalLdap.setConfig(conf));
|
||||
expect(error.reason).to.equal(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
@@ -289,7 +288,7 @@ describe('External LDAP', function () {
|
||||
conf.syncGroups = true;
|
||||
delete conf.groupnameField;
|
||||
|
||||
const [error] = await safe(settings.setExternalLdapConfig(conf));
|
||||
const [error] = await safe(externalLdap.setConfig(conf));
|
||||
expect(error.reason).to.equal(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
@@ -298,7 +297,7 @@ describe('External LDAP', function () {
|
||||
conf.syncGroups = true;
|
||||
conf.groupnameField = '';
|
||||
|
||||
const [error] = await safe(settings.setExternalLdapConfig(conf));
|
||||
const [error] = await safe(externalLdap.setConfig(conf));
|
||||
expect(error.reason).to.equal(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
@@ -306,13 +305,13 @@ describe('External LDAP', function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.syncGroups = true;
|
||||
|
||||
await settings.setExternalLdapConfig(conf);
|
||||
await externalLdap.setConfig(conf);
|
||||
});
|
||||
});
|
||||
|
||||
describe('sync', function () {
|
||||
it('disable sync', async function () {
|
||||
await settings.setExternalLdapConfig({ provider: 'noop' });
|
||||
await externalLdap.setConfig({ provider: 'noop' });
|
||||
});
|
||||
|
||||
it('fails if disabled', async function () {
|
||||
@@ -321,7 +320,7 @@ describe('External LDAP', function () {
|
||||
});
|
||||
|
||||
it('enable', async function () {
|
||||
await settings.setExternalLdapConfig(LDAP_CONFIG);
|
||||
await externalLdap.setConfig(LDAP_CONFIG);
|
||||
});
|
||||
|
||||
it('succeeds for new users', async function () {
|
||||
@@ -376,7 +375,7 @@ describe('External LDAP', function () {
|
||||
it('enable with groupSync', async function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.syncGroups = true;
|
||||
await settings.setExternalLdapConfig(conf);
|
||||
await externalLdap.setConfig(conf);
|
||||
});
|
||||
|
||||
it('succeeds with groups enabled', async function () {
|
||||
@@ -474,7 +473,7 @@ describe('External LDAP', function () {
|
||||
after(server.stop);
|
||||
|
||||
it('enable', async function () {
|
||||
await settings.setExternalLdapConfig(LDAP_CONFIG);
|
||||
await externalLdap.setConfig(LDAP_CONFIG);
|
||||
});
|
||||
|
||||
it('fails if auto create is disabled', async function () {
|
||||
@@ -499,7 +498,7 @@ describe('External LDAP', function () {
|
||||
it('enable auto create', async function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.autoCreate = true;
|
||||
await settings.setExternalLdapConfig(conf);
|
||||
await externalLdap.setConfig(conf);
|
||||
});
|
||||
|
||||
it('fails for unknown user', async function () {
|
||||
|
||||
Reference in New Issue
Block a user