[WO-295] email-dao integration tests

This commit is contained in:
Andris Reinman 2014-06-11 10:42:34 +03:00 committed by Felix Hammerl
parent 07222d24f4
commit 20f12f042b
6 changed files with 403 additions and 83 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,
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,
mail: options.email
}, callback);
};

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();