Add crud for exposed ldap settings
This commit is contained in:
@@ -79,6 +79,55 @@ describe('Settings API', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('exposed_ldap_config', function () {
|
||||
// keep in sync with defaults in settings.js
|
||||
let defaultConfig = {
|
||||
enabled: false
|
||||
};
|
||||
|
||||
it('can get exposed_ldap_config (default)', async function () {
|
||||
const response = await superagent.get(`${serverUrl}/api/v1/settings/exposed_ldap_config`)
|
||||
.query({ access_token: owner.token });
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.body).to.eql(defaultConfig);
|
||||
});
|
||||
|
||||
it('cannot set exposed_ldap_config without enabled boolean', async function () {
|
||||
let tmp = JSON.parse(JSON.stringify(defaultConfig));
|
||||
delete tmp.enabled;
|
||||
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/settings/exposed_ldap_config`)
|
||||
.query({ access_token: owner.token })
|
||||
.send(tmp)
|
||||
.ok(() => true);
|
||||
|
||||
expect(response.statusCode).to.equal(400);
|
||||
});
|
||||
|
||||
it('can set exposed_ldap_config', async function () {
|
||||
let tmp = JSON.parse(JSON.stringify(defaultConfig));
|
||||
tmp.enabled = true;
|
||||
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/settings/exposed_ldap_config`)
|
||||
.query({ access_token: owner.token })
|
||||
.send(tmp);
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
});
|
||||
|
||||
it('can get exposed_ldap_config', async function () {
|
||||
let tmp = JSON.parse(JSON.stringify(defaultConfig));
|
||||
tmp.enabled = true;
|
||||
|
||||
const response = await superagent.get(`${serverUrl}/api/v1/settings/exposed_ldap_config`)
|
||||
.query({ access_token: owner.token });
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.body).to.eql({ enabled: true });
|
||||
});
|
||||
});
|
||||
|
||||
describe('backup_config', function () {
|
||||
// keep in sync with defaults in settings.js
|
||||
let defaultConfig = {
|
||||
|
||||
Reference in New Issue
Block a user