replace with custom superagent based on fetch API
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
const common = require('./common.js'),
|
||||
expect = require('expect.js'),
|
||||
superagent = require('superagent');
|
||||
superagent = require('../../superagent.js');
|
||||
|
||||
describe('Directory Server API', function () {
|
||||
const { setup, cleanup, serverUrl, owner } = common;
|
||||
@@ -27,7 +27,7 @@ describe('Directory Server API', function () {
|
||||
const response = await superagent.get(`${serverUrl}/api/v1/directory_server/config`)
|
||||
.query({ access_token: owner.token });
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.status).to.equal(200);
|
||||
expect(response.body).to.eql(defaultConfig);
|
||||
});
|
||||
|
||||
@@ -40,7 +40,7 @@ describe('Directory Server API', function () {
|
||||
.send(tmp)
|
||||
.ok(() => true);
|
||||
|
||||
expect(response.statusCode).to.equal(400);
|
||||
expect(response.status).to.equal(400);
|
||||
});
|
||||
|
||||
it('cannot set directory_server config without secret', async function () {
|
||||
@@ -53,7 +53,7 @@ describe('Directory Server API', function () {
|
||||
.send(tmp)
|
||||
.ok(() => true);
|
||||
|
||||
expect(response.statusCode).to.equal(400);
|
||||
expect(response.status).to.equal(400);
|
||||
});
|
||||
|
||||
it('cannot enable directory_server config with empty secret', async function () {
|
||||
@@ -65,7 +65,7 @@ describe('Directory Server API', function () {
|
||||
.send(tmp)
|
||||
.ok(() => true);
|
||||
|
||||
expect(response.statusCode).to.equal(400);
|
||||
expect(response.status).to.equal(400);
|
||||
});
|
||||
|
||||
it('cannot enable directory_server config with empty allowlist', async function () {
|
||||
@@ -78,7 +78,7 @@ describe('Directory Server API', function () {
|
||||
.send(tmp)
|
||||
.ok(() => true);
|
||||
|
||||
expect(response.statusCode).to.equal(400);
|
||||
expect(response.status).to.equal(400);
|
||||
});
|
||||
|
||||
it('can enable directory_server config', async function () {
|
||||
@@ -91,7 +91,7 @@ describe('Directory Server API', function () {
|
||||
.query({ access_token: owner.token })
|
||||
.send(tmp);
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.status).to.equal(200);
|
||||
});
|
||||
|
||||
it('can get directory_server config', async function () {
|
||||
@@ -101,7 +101,7 @@ describe('Directory Server API', function () {
|
||||
const response = await superagent.get(`${serverUrl}/api/v1/directory_server/config`)
|
||||
.query({ access_token: owner.token });
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.status).to.equal(200);
|
||||
expect(response.body).to.eql({ enabled: true, secret: 'ldapsecret', allowlist: '1.2.3.4' });
|
||||
});
|
||||
|
||||
@@ -115,7 +115,7 @@ describe('Directory Server API', function () {
|
||||
.query({ access_token: owner.token })
|
||||
.send(tmp);
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.status).to.equal(200);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user