From b0c45d00c367d39f8cee699b7789eca002fb24f8 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Thu, 13 Oct 2016 19:48:48 -0700 Subject: [PATCH] check email subject correctly --- cloudron.js | 8 ++++++++ test/cloudron-user-test.js | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cloudron.js b/cloudron.js index efdd454..ceefbe8 100644 --- a/cloudron.js +++ b/cloudron.js @@ -462,6 +462,14 @@ Cloudron.prototype.setEmailEnabled = function (enabled) { sleep(60); // generously wait for the mail server to restart. it takes 10 seconds to stop it... and then there is DNS propagation }; +Cloudron.prototype.setCloudronName = function (name) { + var res = request + .post(this._origin + '/api/v1/settings/cloudron_name').query({ access_token: this._credentials.accessToken }) + .send({ name: name}) + .end(); + common.verifyResponse2xx(res, 'Could not enable email'); +}; + Cloudron.prototype.checkTimeZone = function (tz) { var res = request.get(this._origin + '/api/v1/settings/time_zone').query({ access_token: this._credentials.accessToken }).end(); common.verifyResponse2xx(res, 'Could not query timezone'); diff --git a/test/cloudron-user-test.js b/test/cloudron-user-test.js index 10c2cbf..be72d8b 100644 --- a/test/cloudron-user-test.js +++ b/test/cloudron-user-test.js @@ -70,12 +70,16 @@ describe('Cloudron user creation testing', function () { newUser = cloudron.addUser('newuser', 'test+foo@cloudron.io'); }); + it('can set cloudron name', function () { + cloudron.setCloudronName('Acme Inc'); + }); + it('did send invite mail to user', function (done) { var url = 'https://' + cloudron.adminFqdn() + '/api/v1/session/account/setup.html?reset_token=' + newUser.resetToken; var escapedUrl = url.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); imap.probe({ - subject: new RegExp('Welcome to Cloudron ' + box.domain + '$'), + subject: new RegExp('Welcome to Acme Inc$'), body: new RegExp(escapedUrl) }, done); });