check email subject correctly

This commit is contained in:
Girish Ramakrishnan 2016-10-13 19:48:48 -07:00
parent a0c88cbd43
commit b0c45d00c3
2 changed files with 13 additions and 1 deletions

View File

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

View File

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