Browse Source

Properly mock publickey requests

master
Tankred Hase 8 years ago
parent
commit
8636ba201b
  1. 11
      test/integration/email-dao-test.js

11
test/integration/email-dao-test.js

@ -249,6 +249,7 @@ describe('Email DAO integration tests', function() { @@ -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,
@ -257,19 +258,17 @@ describe('Email DAO integration tests', function() { @@ -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

Loading…
Cancel
Save