Start using POST /api/v1/apps to install

This commit is contained in:
Johannes Zellner
2024-11-20 16:16:51 +01:00
parent b4d58f0609
commit 78cb36ea0e
3 changed files with 21 additions and 20 deletions

View File

@@ -234,7 +234,7 @@ xdescribe('App API', function () {
describe('Install', function () {
it('app install fails - missing manifest', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.end(function (err, res) {
expect(res.statusCode).to.equal(400);
@@ -244,7 +244,7 @@ xdescribe('App API', function () {
});
it('app install fails - null manifest', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.send({ manifest: null })
.end(function (err, res) {
@@ -255,7 +255,7 @@ xdescribe('App API', function () {
});
it('app install fails - bad manifest format', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.send({ manifest: 'epic' })
.end(function (err, res) {
@@ -266,7 +266,7 @@ xdescribe('App API', function () {
});
it('app install fails - empty appStoreId format', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.send({ manifest: null, appStoreId: '' })
.end(function (err, res) {
@@ -277,7 +277,7 @@ xdescribe('App API', function () {
});
it('app install fails - invalid json', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.send('garbage')
.end(function (err, res) {
@@ -287,7 +287,7 @@ xdescribe('App API', function () {
});
it('app install fails - missing domain', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.send({ manifest: APP_MANIFEST, subdomain: 'some', accessRestriction: null })
.end(function (err, res) {
@@ -298,7 +298,7 @@ xdescribe('App API', function () {
});
it('app install fails - non-existing domain', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.send({ manifest: APP_MANIFEST, subdomain: 'some', accessRestriction: null, domain: 'doesnotexist.com' })
.end(function (err, res) {
@@ -309,7 +309,7 @@ xdescribe('App API', function () {
});
it('app install fails - invalid subdomain type', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.send({ manifest: APP_MANIFEST, subdomain: 42, accessRestriction: null, domain: DOMAIN_0.domain })
.end(function (err, res) {
@@ -320,7 +320,7 @@ xdescribe('App API', function () {
});
it('app install fails - reserved admin subdomain', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.send({ manifest: APP_MANIFEST, subdomain: 'my', accessRestriction: null, domain: DOMAIN_0.domain })
.end(function (err, res) {
@@ -331,7 +331,7 @@ xdescribe('App API', function () {
});
it('app install fails - reserved smtp subdomain', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.send({ manifest: APP_MANIFEST, subdomain: constants.SMTP_SUBDOMAIN, accessRestriction: null, domain: DOMAIN_0.domain })
.end(function (err, res) {
@@ -342,7 +342,7 @@ xdescribe('App API', function () {
});
it('app install fails - portBindings must be object', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.send({ manifest: APP_MANIFEST, subdomain: APP_SUBDOMAIN, portBindings: 23, accessRestriction: null, domain: DOMAIN_0.domain })
.end(function (err, res) {
@@ -353,7 +353,7 @@ xdescribe('App API', function () {
});
it('app install fails - accessRestriction is required', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.send({ manifest: APP_MANIFEST, subdomain: APP_SUBDOMAIN, portBindings: {}, domain: DOMAIN_0.domain })
.end(function (err, res) {
@@ -364,7 +364,7 @@ xdescribe('App API', function () {
});
it('app install fails - accessRestriction type is wrong', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.send({ manifest: APP_MANIFEST, subdomain: APP_SUBDOMAIN, portBindings: {}, accessRestriction: '', domain: DOMAIN_0.domain })
.end(function (err, res) {
@@ -375,7 +375,7 @@ xdescribe('App API', function () {
});
it('app install fails for non admin', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token_1 })
.send({ manifest: APP_MANIFEST, subdomain: APP_SUBDOMAIN, portBindings: null, accessRestriction: null, domain: DOMAIN_0.domain })
.end(function (err, res) {
@@ -387,7 +387,7 @@ xdescribe('App API', function () {
it('app install fails because manifest download fails', function (done) {
const fake = nock(settings.apiServerOrigin()).get('/api/v1/apps/test').reply(404, {});
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.send({ appStoreId: APP_STORE_ID, subdomain: APP_SUBDOMAIN, portBindings: null, domain: DOMAIN_0.domain, accessRestriction: { users: [ 'someuser' ], groups: [] } })
.end(function (err, res) {
@@ -400,7 +400,7 @@ xdescribe('App API', function () {
it('app install fails due to purchase failure', function (done) {
const fake1 = nock(settings.apiServerOrigin()).get('/api/v1/apps/test').reply(200, { manifest: APP_MANIFEST });
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.send({ appStoreId: APP_STORE_ID, subdomain: APP_SUBDOMAIN, domain: DOMAIN_0.domain, portBindings: null, accessRestriction: null })
.end(function (err, res) {
@@ -416,7 +416,7 @@ xdescribe('App API', function () {
await settings.setAppstoreApiToken(USER_1_APPSTORE_TOKEN);
const res = await superagent.post(SERVER_URL + '/api/v1/apps/install')
const res = await superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.send({ appStoreId: APP_STORE_ID, subdomain: APP_SUBDOMAIN, domain: DOMAIN_0.domain, portBindings: { ECHO_SERVER_PORT: 7171 }, accessRestriction: { users: [ 'someuser' ], groups: [] } })
@@ -429,7 +429,7 @@ xdescribe('App API', function () {
});
it('app install fails because of conflicting subdomain', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/install')
superagent.post(SERVER_URL + '/api/v1/apps')
.query({ access_token: token })
.send({ manifest: APP_MANIFEST, subdomain: APP_SUBDOMAIN, domain: DOMAIN_0.domain, portBindings: null, accessRestriction: null })
.end(function (err, res) {