remove pgpmailer.login()

This commit is contained in:
Felix Hammerl 2014-02-27 17:42:10 +01:00
parent 71dad31d6f
commit 37d4a74aa3
3 changed files with 2 additions and 35 deletions

View File

@ -13,7 +13,7 @@
"crypto-lib": "https://github.com/whiteout-io/crypto-lib/tarball/master",
"imap-client": "https://github.com/whiteout-io/imap-client/tarball/master",
"mailreader": "https://github.com/whiteout-io/mailreader/tarball/master",
"pgpmailer": "https://github.com/whiteout-io/pgpmailer/tarball/master",
"pgpmailer": "https://github.com/whiteout-io/pgpmailer/tarball/dev/fix-smtp",
"pgpbuilder": "https://github.com/whiteout-io/pgpbuilder/tarball/master",
"requirejs": "2.1.10"
},

View File

@ -82,9 +82,6 @@ define(function(require) {
}
};
// connect the pgpmailer
self._pgpmailerLogin();
// connect to newly created imap client
self._imapLogin(function(err) {
if (err) {
@ -1110,16 +1107,6 @@ define(function(require) {
this._devicestorage.removeList(dbType, callback);
};
// PGP Mailer API
/**
* Login the smtp client
*/
EmailDAO.prototype._pgpmailerLogin = function() {
this._pgpMailer.login();
};
// IMAP API
/**

View File

@ -278,12 +278,11 @@ define(function(require) {
});
describe('onConnect', function() {
var imapLoginStub, imapListFoldersStub, pgpmailerLoginStub;
var imapLoginStub, imapListFoldersStub;
beforeEach(function(done) {
// imap login
imapLoginStub = sinon.stub(dao, '_imapLogin');
pgpmailerLoginStub = sinon.stub(dao, '_pgpmailerLogin');
imapListFoldersStub = sinon.stub(dao, '_imapListFolders');
dao.onDisconnect(null, function(err) {
@ -297,20 +296,17 @@ define(function(require) {
afterEach(function() {
imapLoginStub.restore();
pgpmailerLoginStub.restore();
imapListFoldersStub.restore();
});
it('should fail due to error in imap login', function(done) {
imapLoginStub.yields({});
pgpmailerLoginStub.returns();
dao.onConnect({
imapClient: imapClientStub,
pgpMailer: pgpMailerStub
}, function(err) {
expect(err).to.exist;
expect(pgpmailerLoginStub.calledOnce).to.be.true;
expect(imapLoginStub.calledOnce).to.be.true;
expect(dao._account.online).to.be.false;
done();
@ -320,7 +316,6 @@ define(function(require) {
it('should work when folder already initiated', function(done) {
dao._account.folders = [];
imapLoginStub.yields();
pgpmailerLoginStub.returns();
dao.onConnect({
imapClient: imapClientStub,
@ -337,7 +332,6 @@ define(function(require) {
it('should work when folder not yet initiated', function(done) {
var folders = [];
imapLoginStub.yields();
pgpmailerLoginStub.returns();
imapListFoldersStub.yields(null, folders);
dao.onConnect({
@ -488,20 +482,6 @@ define(function(require) {
});
});
describe('_pgpmailerLogin', function() {
it('should work', function() {
// called once in onConnect
expect(pgpMailerStub.login.calledOnce).to.be.true;
pgpMailerStub.login.returns();
dao._pgpmailerLogin();
expect(pgpMailerStub.login.calledTwice).to.be.true;
});
});
describe('_imapLogin', function() {
it('should fail when disconnected', function(done) {
dao.onDisconnect(null, function(err) {