1
0
mirror of https://github.com/moparisthebest/mail synced 2024-12-24 08:18: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) { middleware: function(connect, options) {
// Return array of whatever middlewares you want // Return array of whatever middlewares you want
return [ return [
function(req, res, next) { 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:;"); 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: { mocha: {
all: { all: {
options: { 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, run: false,
reporter: 'Spec' reporter: 'Spec',
log: false,
// phanotmjs is soooo slow
timeout: 100000
} }
} }
}, },
@ -149,7 +157,7 @@ module.exports = function(grunt) {
expand: true, expand: true,
flatten: true, flatten: true,
cwd: 'node_modules/', 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/' dest: 'test/lib/'
}, },
cryptoLib: { cryptoLib: {

View File

@ -6,7 +6,7 @@
}, },
"scripts": { "scripts": {
"postinstall": "grunt dist-npm", "postinstall": "grunt dist-npm",
"test": "grunt test && grunt", "test": "grunt && grunt test",
"start": "grunt && grunt dev" "start": "grunt && grunt dev"
}, },
"dependencies": { "dependencies": {
@ -19,6 +19,8 @@
}, },
"devDependencies": { "devDependencies": {
"angularjs": "https://github.com/angular/angular.js/tarball/v1.2.8", "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", "grunt": "~0.4.1",
"mocha": "~1.13.0", "mocha": "~1.13.0",
"chai": "~1.7.2", "chai": "~1.7.2",

View File

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

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,14 @@
require(['src/require-config'], function() { require(['src/require-config'], function() {
require.config({ 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. // Start the main app logic.

View File

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