domain: split the config and wellknown routes
we want to add more stuff to the UI like the jitsi URL
This commit is contained in:
@@ -152,6 +152,40 @@ describe('Domains API', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('update', function () {
|
||||
it('config fails for non-existing domain', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/domains/whatever/update`)
|
||||
.query({ access_token: owner.token })
|
||||
.ok(() => true);
|
||||
|
||||
expect(response.statusCode).to.equal(404);
|
||||
});
|
||||
|
||||
it('config succeeds', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/domains/${DOMAIN_0.domain}/config`)
|
||||
.query({ access_token: owner.token })
|
||||
.send(DOMAIN_0);
|
||||
|
||||
expect(response.statusCode).to.equal(204);
|
||||
});
|
||||
|
||||
it('wellknown succeeds', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/domains/${DOMAIN_0.domain}/wellknown`)
|
||||
.query({ access_token: owner.token })
|
||||
.send({ wellKnown: null });
|
||||
|
||||
expect(response.statusCode).to.equal(204);
|
||||
});
|
||||
|
||||
it('wellknown succeeds', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/domains/${DOMAIN_0.domain}/wellknown`)
|
||||
.query({ access_token: owner.token })
|
||||
.send({ wellKnown: { service: 'some.service' } });
|
||||
|
||||
expect(response.statusCode).to.equal(204);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Certificates API', function () {
|
||||
let validCert0, validKey0, // example.com
|
||||
validCert1, validKey1; // *.example.com
|
||||
@@ -170,7 +204,7 @@ describe('Domains API', function () {
|
||||
let d = Object.assign({}, DOMAIN_0);
|
||||
d.fallbackCertificate = { key: validKey1 };
|
||||
|
||||
const response = await superagent.put(`${serverUrl}/api/v1/domains/${DOMAIN_0.domain}`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/domains/${DOMAIN_0.domain}/config`)
|
||||
.query({ access_token: owner.token })
|
||||
.send(d)
|
||||
.ok(() => true);
|
||||
@@ -182,7 +216,7 @@ describe('Domains API', function () {
|
||||
let d = Object.assign({}, DOMAIN_0);
|
||||
d.fallbackCertificate = { cert: validCert1 };
|
||||
|
||||
const response = await superagent.put(`${serverUrl}/api/v1/domains/${DOMAIN_0.domain}`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/domains/${DOMAIN_0.domain}/config`)
|
||||
.query({ access_token: owner.token })
|
||||
.send(d)
|
||||
.ok(() => true);
|
||||
@@ -194,7 +228,7 @@ describe('Domains API', function () {
|
||||
let d = Object.assign({}, DOMAIN_0);
|
||||
d.fallbackCertificate = { cert: 1234, key: validKey1 };
|
||||
|
||||
const response = await superagent.put(`${serverUrl}/api/v1/domains/${DOMAIN_0.domain}`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/domains/${DOMAIN_0.domain}/config`)
|
||||
.query({ access_token: owner.token })
|
||||
.send(d)
|
||||
.ok(() => true);
|
||||
@@ -206,7 +240,7 @@ describe('Domains API', function () {
|
||||
let d = Object.assign({}, DOMAIN_0);
|
||||
d.fallbackCertificate = { cert: validCert1, key: true };
|
||||
|
||||
const response = await superagent.put(`${serverUrl}/api/v1/domains/${DOMAIN_0.domain}`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/domains/${DOMAIN_0.domain}/config`)
|
||||
.query({ access_token: owner.token })
|
||||
.send(d)
|
||||
.ok(() => true);
|
||||
@@ -218,7 +252,7 @@ describe('Domains API', function () {
|
||||
let d = Object.assign({}, DOMAIN_0);
|
||||
d.fallbackCertificate = { cert: validCert0, key: validKey0 };
|
||||
|
||||
const response = await superagent.put(`${serverUrl}/api/v1/domains/${DOMAIN_0.domain}`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/domains/${DOMAIN_0.domain}/config`)
|
||||
.query({ access_token: owner.token })
|
||||
.send(d)
|
||||
.ok(() => true);
|
||||
@@ -230,7 +264,7 @@ describe('Domains API', function () {
|
||||
let d = Object.assign({}, DOMAIN_0);
|
||||
d.fallbackCertificate = { cert: validCert1, key: validKey1 };
|
||||
|
||||
const response = await superagent.put(`${serverUrl}/api/v1/domains/${DOMAIN_0.domain}`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/domains/${DOMAIN_0.domain}/config`)
|
||||
.query({ access_token: owner.token })
|
||||
.send(d);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user