1
0
mirror of https://github.com/moparisthebest/mail synced 2024-12-23 07:48:48 -05:00

Merge pull request #70 from whiteout-io/dev/WO-295

[WO-295] email-dao integration tests
This commit is contained in:
Felix Hammerl 2014-06-17 13:01:21 +02:00
commit 583c06d622
6 changed files with 404 additions and 84 deletions

View File

@ -28,6 +28,7 @@ module.exports = function(grunt) {
middleware: function(connect, options) {
// Return array of whatever middlewares you want
return [
function(req, res, next) {
res.setHeader('Content-Security-Policy', "default-src 'self'; object-src 'none'; connect-src 'self' https://keys.whiteout.io; img-src 'self' data:;");
@ -64,9 +65,16 @@ module.exports = function(grunt) {
mocha: {
all: {
options: {
urls: ['http://localhost:<%= connect.test.options.port %>/test/new-unit/index.html'],
urls: [
'http://localhost:<%= connect.test.options.port %>/test/new-unit/index.html',
'http://localhost:<%= connect.test.options.port %>/test/integration/index.html'
],
run: false,
reporter: 'Spec'
reporter: 'Spec',
log: false,
// phanotmjs is soooo slow
timeout: 100000
}
}
},
@ -149,7 +157,7 @@ module.exports = function(grunt) {
expand: true,
flatten: true,
cwd: 'node_modules/',
src: ['requirejs/require.js', 'mocha/mocha.css', 'mocha/mocha.js', 'chai/chai.js', 'sinon/pkg/sinon.js', 'angularjs/src/ngMock/angular-mocks.js'],
src: ['requirejs/require.js', 'mocha/mocha.css', 'mocha/mocha.js', 'chai/chai.js', 'sinon/pkg/sinon.js', 'angularjs/src/ngMock/angular-mocks.js', 'browsercrow/src/*.js', 'browsersmtp/src/*.js'],
dest: 'test/lib/'
},
cryptoLib: {

View File

@ -6,7 +6,7 @@
},
"scripts": {
"postinstall": "grunt dist-npm",
"test": "grunt test && grunt",
"test": "grunt && grunt test",
"start": "grunt && grunt dev"
},
"dependencies": {
@ -19,6 +19,8 @@
},
"devDependencies": {
"angularjs": "https://github.com/angular/angular.js/tarball/v1.2.8",
"browsercrow": "https://github.com/whiteout-io/browsercrow/tarball/master",
"browsersmtp": "https://github.com/whiteout-io/browsersmtp/tarball/master",
"grunt": "~0.4.1",
"mocha": "~1.13.0",
"chai": "~1.7.2",

View File

@ -886,6 +886,7 @@ define(function(require) {
self._pgpMailer.send({
encrypt: true,
cleartextMessage: str.message + str.signature,
smtpclient: options.smtpclient, // filled solely in the integration test, undefined in normal usage
mail: options.email,
publicKeysArmored: options.email.publicKeysArmored
}, callback);
@ -908,6 +909,7 @@ define(function(require) {
// mime encode, sign and send email via smtp
this._pgpMailer.send({
smtpclient: options.smtpclient, // filled solely in the integration test, undefined in normal usage
mail: options.email
}, callback);
};
@ -1451,4 +1453,4 @@ define(function(require) {
}
return EmailDAO;
});
});

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,14 @@
require(['src/require-config'], function() {
require.config({
baseUrl: 'src/lib'
baseUrl: 'src/lib',
paths: {
'browsercrow': '../../../lib/browsercrow',
'browsercrow-envelope': '../../../lib/browsercrow-envelope',
'browsercrow-bodystructure': '../../../lib/browsercrow-bodystructure',
'browsercrow-mimeparser': '../../../lib/browsercrow-mimeparser',
'browsersmtp': '../../../lib/browsersmtp'
}
});
// Start the main app logic.

View File

@ -1382,6 +1382,7 @@ define(function(require) {
encrypt: true,
cleartextMessage: str.message + str.signature,
mail: dummyMail,
smtpclient: undefined,
publicKeysArmored: publicKeys
}).yieldsAsync();
@ -1427,6 +1428,7 @@ define(function(require) {
it('should send in the plain', function(done) {
pgpMailerStub.send.withArgs({
smtpclient: undefined,
mail: dummyMail
}).yieldsAsync();