1
0
mirror of https://github.com/moparisthebest/mail synced 2024-12-25 00:38:54 -05:00

Properly mock publickey requests

This commit is contained in:
Tankred Hase 2015-08-05 14:10:29 +02:00
parent aa24881efc
commit 8636ba201b

View File

@ -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() {
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