Validate tags in one place only and add tests

This commit is contained in:
Johannes Zellner
2019-04-16 16:36:11 +02:00
parent 332c860e80
commit e756a442f6
3 changed files with 27 additions and 14 deletions

View File

@@ -1021,6 +1021,30 @@ describe('App installation', function () {
});
});
it('cannot reconfigure app with invalid tags', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/' + APP_ID + '/configure')
.query({ access_token: token })
.send({ location: APP_LOCATION_NEW, portBindings: { ECHO_SERVER_PORT: 7172 }, tags: 'foobar' })
.end(function (err, res) {
expect(res.statusCode).to.equal(400);
superagent.post(SERVER_URL + '/api/v1/apps/' + APP_ID + '/configure')
.query({ access_token: token })
.send({ location: APP_LOCATION_NEW, portBindings: { ECHO_SERVER_PORT: 7172 }, tags: ['hello', '', 'there' ] })
.end(function (err, res) {
expect(res.statusCode).to.equal(400);
superagent.post(SERVER_URL + '/api/v1/apps/' + APP_ID + '/configure')
.query({ access_token: token })
.send({ location: APP_LOCATION_NEW, portBindings: { ECHO_SERVER_PORT: 7172 }, tags: ['hello', 1234, 'there' ] })
.end(function (err, res) {
expect(res.statusCode).to.equal(400);
done();
});
});
});
});
it('non admin cannot reconfigure app', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/' + APP_ID + '/configure')
.query({ access_token: token_1 })