1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-29 20:32:15 -05:00

[WO-18] rename methods in email dao

This commit is contained in:
Felix Hammerl 2013-11-20 14:58:31 +01:00
parent 6ad8683380
commit 6fa06fc4e8
4 changed files with 9 additions and 9 deletions

View File

@ -62,7 +62,7 @@ define(function(require) {
} }
var email = emails.shift(); var email = emails.shift();
self._emailDao.smtpSend(email, function(err) { self._emailDao.encryptedSend(email, function(err) {
if (err) { if (err) {
self._outboxBusy = false; self._outboxBusy = false;
callback(err); callback(err);

View File

@ -534,7 +534,7 @@ define(function(require) {
/** /**
* Send an email client side via STMP. * Send an email client side via STMP.
*/ */
EmailDAO.prototype.smtpSend = function(email, callback) { EmailDAO.prototype.encryptedSend = function(email, callback) {
var self = this, var self = this,
invalidRecipient; invalidRecipient;

View File

@ -255,7 +255,7 @@ define(function(require) {
describe('SMTP: send email', function() { describe('SMTP: send email', function() {
it('should fail due to bad input', function(done) { it('should fail due to bad input', function(done) {
emailDao.smtpSend({}, function(err) { emailDao.encryptedSend({}, function(err) {
expect(smtpClientStub.send.called).to.be.false; expect(smtpClientStub.send.called).to.be.false;
expect(keychainStub.getReceiverPublicKey.called).to.be.false; expect(keychainStub.getReceiverPublicKey.called).to.be.false;
expect(err).to.exist; expect(err).to.exist;
@ -267,7 +267,7 @@ define(function(require) {
dummyMail.to = [{ dummyMail.to = [{
address: 'asfd' address: 'asfd'
}]; }];
emailDao.smtpSend(dummyMail, function(err) { emailDao.encryptedSend(dummyMail, function(err) {
expect(smtpClientStub.send.called).to.be.false; expect(smtpClientStub.send.called).to.be.false;
expect(keychainStub.getReceiverPublicKey.called).to.be.false; expect(keychainStub.getReceiverPublicKey.called).to.be.false;
expect(err).to.exist; expect(err).to.exist;
@ -279,7 +279,7 @@ define(function(require) {
keychainStub.getReceiverPublicKey.yields(null, null); keychainStub.getReceiverPublicKey.yields(null, null);
smtpClientStub.send.yields(); smtpClientStub.send.yields();
emailDao.smtpSend(dummyMail, function(err) { emailDao.encryptedSend(dummyMail, function(err) {
expect(keychainStub.getReceiverPublicKey.calledOnce).to.be.true; expect(keychainStub.getReceiverPublicKey.calledOnce).to.be.true;
// expect(smtpClientStub.send.called).to.be.true; // expect(smtpClientStub.send.called).to.be.true;
// smtpClientStub.send.calledWith(sinon.match(function(o) { // smtpClientStub.send.calledWith(sinon.match(function(o) {
@ -300,7 +300,7 @@ define(function(require) {
pgpStub.encrypt.yields(null, 'asdfasfd'); pgpStub.encrypt.yields(null, 'asdfasfd');
smtpClientStub.send.yields(); smtpClientStub.send.yields();
emailDao.smtpSend(dummyMail, function(err) { emailDao.encryptedSend(dummyMail, function(err) {
expect(keychainStub.getReceiverPublicKey.calledOnce).to.be.true; expect(keychainStub.getReceiverPublicKey.calledOnce).to.be.true;
expect(pgpStub.exportKeys.calledOnce).to.be.true; expect(pgpStub.exportKeys.calledOnce).to.be.true;
expect(pgpStub.encrypt.calledOnce).to.be.true; expect(pgpStub.encrypt.calledOnce).to.be.true;
@ -328,7 +328,7 @@ define(function(require) {
// pgpStub.encrypt.yields(null, 'asdfasfd'); // pgpStub.encrypt.yields(null, 'asdfasfd');
// smtpClientStub.send.yields(); // smtpClientStub.send.yields();
// emailDao.smtpSend(dummyMail, function(err) { // emailDao.encryptedSend(dummyMail, function(err) {
// expect(keychainStub.getReceiverPublicKey.calledOnce).to.be.true; // expect(keychainStub.getReceiverPublicKey.calledOnce).to.be.true;
// expect(pgpStub.exportKeys.calledOnce).to.be.true; // expect(pgpStub.exportKeys.calledOnce).to.be.true;
// expect(pgpStub.encrypt.calledOnce).to.be.true; // expect(pgpStub.encrypt.calledOnce).to.be.true;

View File

@ -47,14 +47,14 @@ define(function(require) {
devicestorageStub.listItems.yields(null, [{ devicestorageStub.listItems.yields(null, [{
id: '12345' id: '12345'
}]); }]);
emailDaoStub.smtpSend.yields(); emailDaoStub.encryptedSend.yields();
devicestorageStub.removeList.yields(); devicestorageStub.removeList.yields();
function onOutboxUpdate(err, count) { function onOutboxUpdate(err, count) {
expect(err).to.not.exist; expect(err).to.not.exist;
if (count === 0) { if (count === 0) {
expect(devicestorageStub.listItems.callCount).to.equal(1); expect(devicestorageStub.listItems.callCount).to.equal(1);
expect(emailDaoStub.smtpSend.callCount).to.equal(1); expect(emailDaoStub.encryptedSend.callCount).to.equal(1);
expect(devicestorageStub.removeList.callCount).to.equal(1); expect(devicestorageStub.removeList.callCount).to.equal(1);
done(); done();
} }