settings: move directory server config to it's own route

This commit is contained in:
Girish Ramakrishnan
2023-08-03 02:26:11 +05:30
parent 4a34c390f8
commit 67e4c90d37
11 changed files with 222 additions and 154 deletions
+41
View File
@@ -0,0 +1,41 @@
'use strict';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
const common = require('./common.js'),
expect = require('expect.js'),
superagent = require('superagent');
describe('External LDAP API', function () {
const { setup, cleanup, serverUrl, owner } = common;
before(setup);
after(cleanup);
describe('external_ldap', function () {
// keep in sync with defaults in settings.js
let defaultConfig = { provider: 'noop', autoCreate: false };
it('can get external_ldap (default)', async function () {
const response = await superagent.get(`${serverUrl}/api/v1/external_ldap/config`)
.query({ access_token: owner.token });
expect(response.statusCode).to.equal(200);
expect(response.body).to.eql(defaultConfig);
});
it('can set external_ldap to noop', async function () {
const config = {
provider: 'noop'
};
const response = await superagent.post(`${serverUrl}/api/v1/external_ldap/config`)
.query({ access_token: owner.token })
.send(config);
expect(response.statusCode).to.equal(200);
});
});
});