Skip to content
This repository has been archived by the owner on Jul 10, 2019. It is now read-only.

Commit

Permalink
Properly mock publickey requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tankred Hase committed Aug 5, 2015
1 parent aa24881 commit 8636ba2
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/integration/email-dao-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ describe('Email DAO integration tests', function() {
function onCleaned() {
userStorage = accountService._accountStore;
auth = accountService._auth;
emailDao = accountService._emailDao;

auth.setCredentials({
emailAddress: testAccount.user,
Expand All @@ -257,19 +258,17 @@ describe('Email DAO integration tests', function() {
imap: {} // a preconfigured smtpclient with mocked tcp sockets
});

// stub rest request to key server
sinon.stub(emailDao._keychain._publicKeyDao, 'get').returns(resolves(mockKeyPair.publicKey));
sinon.stub(emailDao._keychain._publicKeyDao, 'getByUserId').returns(resolves(mockKeyPair.publicKey));

auth.init().then(function() {
accountService.init({
emailAddress: testAccount.user
}).then(function() {
emailDao = accountService._emailDao;

// retrieve the pgpbuilder from the emaildao and initialize the pgpmailer with the existing pgpbuilder
pgpMailer = new PgpMailer({}, emailDao._pgpbuilder);

// stub rest request to key server
sinon.stub(emailDao._keychain._publicKeyDao, 'get').returns(resolves(mockKeyPair.publicKey));
sinon.stub(emailDao._keychain._publicKeyDao, 'getByUserId').returns(resolves(mockKeyPair.publicKey));

emailDao.unlock({
passphrase: testAccount.pass,
keypair: mockKeyPair
Expand Down

0 comments on commit 8636ba2

Please sign in to comment.