Add HTTP integration tests

This commit is contained in:
Tankred Hase
2016-06-01 15:20:49 +02:00
parent a27e833a8d
commit 45b7b95a5f
3 changed files with 413 additions and 23 deletions

View File

@@ -3,6 +3,7 @@
require('co-mocha')(require('mocha')); // monkey patch mocha for generators
const log = require('npmlog');
const config = require('config');
const openpgp = require('openpgp');
const nodemailer = require('nodemailer');
const Email = require('../../src/email/email');
@@ -12,6 +13,8 @@ const PublicKey = require('../../src/service/public-key');
const expect = require('chai').expect;
const sinon = require('sinon');
log.level = config.log.level;
describe('Public Key Integration Tests', function() {
this.timeout(20000);
@@ -74,10 +77,14 @@ describe('Public Key Integration Tests', function() {
});
describe('put', () => {
it('should persist key and send verification email', function *() {
it('should persist key and send verification email with primaryEmail', function *() {
yield publicKey.put({ publicKeyArmored, primaryEmail, origin });
expect(emailParams.nonce).to.exist;
});
it('should persist key and send verification email without primaryEmail', function *() {
yield publicKey.put({ publicKeyArmored, origin });
expect(emailParams.nonce).to.exist;
});
it('should work twice if not yet verified', function *() {
yield publicKey.put({ publicKeyArmored, primaryEmail, origin });