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:
Girish Ramakrishnan
2021-12-03 13:46:54 -08:00
parent 5592dc8a42
commit 39807e6ba4
8 changed files with 107 additions and 41 deletions

View File

@@ -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);