add mailboxDomain field to apps table

This commit is contained in:
Girish Ramakrishnan
2019-11-14 21:43:14 -08:00
parent 97333474c4
commit 5509406395
11 changed files with 83 additions and 54 deletions
+2 -1
View File
@@ -295,8 +295,9 @@ function setMailbox(req, res, next) {
assert.strictEqual(typeof req.params.id, 'string');
if (req.body.mailboxName !== null && typeof req.body.mailboxName !== 'string') return next(new HttpError(400, 'mailboxName must be a string'));
if (typeof req.body.mailboxDomain !== 'string') return next(new HttpError(400, 'mailboxDomain must be a string'));
apps.setMailbox(req.params.id, req.body.mailboxName, auditSource.fromRequest(req), function (error, result) {
apps.setMailbox(req.params.id, req.body.mailboxName, req.body.mailboxDomain, auditSource.fromRequest(req), function (error, result) {
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(202, { taskId: result.taskId }));
+4 -2
View File
@@ -480,6 +480,7 @@ describe('App API', function () {
expect(res.body.id).to.eql(APP_ID);
expect(res.body.installationState).to.be.ok();
expect(res.body.mailboxName).to.be(APP_LOCATION + '.app');
expect(res.body.mailboxDomain).to.be(DOMAIN_0.domain);
done();
});
});
@@ -1153,6 +1154,7 @@ describe('App API', function () {
if (error) return done(error);
expect(app.mailboxName).to.be(APP_LOCATION_NEW + '.app'); // must follow location change
expect(app.mailboxDomain).to.be(DOMAIN_0.domain);
docker.getContainer(app.containerId).inspect(function (error, data) {
expect(error).to.not.be.ok();
@@ -1364,7 +1366,7 @@ describe('App API', function () {
it('can set mailbox', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/' + APP_ID + '/configure/mailbox')
.query({ access_token: token })
.send({ mailboxName: 'genos' })
.send({ mailboxName: 'genos', mailboxDomain: DOMAIN_0.domain })
.end(function (err, res) {
expect(res.statusCode).to.equal(202);
taskId = res.body.taskId;
@@ -1392,7 +1394,7 @@ describe('App API', function () {
it('can reset mailbox', function (done) {
superagent.post(SERVER_URL + '/api/v1/apps/' + APP_ID + '/configure/mailbox')
.query({ access_token: token })
.send({ mailboxName: null })
.send({ mailboxName: null, mailboxDomain: DOMAIN_0.domain })
.end(function (err, res) {
expect(res.statusCode).to.equal(202);
taskId = res.body.taskId;