check mail is sent when cloudron is ready

This commit is contained in:
Girish Ramakrishnan 2016-06-23 14:43:39 -05:00
parent b78a105b79
commit 6ae83ac3fe
2 changed files with 19 additions and 2 deletions

View File

@ -182,7 +182,7 @@ ImapProbe.prototype._scanBox = function (needle, callback) {
ImapProbe.prototype.probe = function (needle, callback) { ImapProbe.prototype.probe = function (needle, callback) {
var that = this; var that = this;
var times = needle.times || 1, interval = needle.interval || 20000; var times = needle.times || 5, interval = needle.interval || 20000;
this._connection.once('error', callback); this._connection.once('error', callback);

View File

@ -10,7 +10,8 @@ var AppStore = require('../appstore.js'),
async = require('async'), async = require('async'),
Cloudron = require('../cloudron.js'), Cloudron = require('../cloudron.js'),
common = require('../common.js'), common = require('../common.js'),
dns = require('dns'); dns = require('dns'),
ImapProbe = require('../imap-probe.js');
require('colors'); require('colors');
@ -26,6 +27,15 @@ describe('Appstore new user flow', function () {
var admin = common.getAdmin(); var admin = common.getAdmin();
var cloudron, appId, box; var cloudron, appId, box;
var imap = new ImapProbe({
user: process.env.IMAP_USERNAME,
password: process.env.IMAP_PASSWORD,
host: process.env.IMAP_HOST,
port: 993, // imap port
tls: true,
readOnly: true
});
it('can login to the store', function () { it('can login to the store', function () {
var accessToken = appStore.getAccessToken(owner); var accessToken = appStore.getAccessToken(owner);
appStore.setCredentials(owner.password, accessToken); appStore.setCredentials(owner.password, accessToken);
@ -54,6 +64,13 @@ describe('Appstore new user flow', function () {
cloudron = new Cloudron(box); cloudron = new Cloudron(box);
}); });
it('sent a mail to the user about cloudron ready', function (done) {
imap.probe({
subject: /^Cloudron tappflow.selfhost.io is ready$/,
from: /Cloudron Team/
}, done);
});
it('can activate the box', function () { it('can activate the box', function () {
cloudron.activate(owner); cloudron.activate(owner);
}); });