Merge pull request #87 from whiteout-io/dev/WO-455

fix signature behavior
This commit is contained in:
Tankred Hase 2014-07-09 11:12:11 +02:00
commit 021510d936
2 changed files with 64 additions and 2 deletions

View File

@ -13,8 +13,8 @@
"crypto-lib": "https://github.com/whiteout-io/crypto-lib/tarball/v0.2.0",
"imap-client": "https://github.com/whiteout-io/imap-client/tarball/v0.3.4",
"mailreader": "https://github.com/whiteout-io/mailreader/tarball/v0.3.4",
"pgpmailer": "https://github.com/whiteout-io/pgpmailer/tarball/v0.3.5",
"pgpbuilder": "https://github.com/whiteout-io/pgpbuilder/tarball/v0.3.4",
"pgpmailer": "https://github.com/whiteout-io/pgpmailer/tarball/v0.3.6",
"pgpbuilder": "https://github.com/whiteout-io/pgpbuilder/tarball/v0.3.5",
"requirejs": "2.1.14",
"axe": "https://github.com/whiteout-io/axe/tarball/v0.0.2"
},

View File

@ -825,5 +825,67 @@ define(function(require) {
});
});
});
describe('Compose-Send-Receive-Read round trip', function() {
var currentFolder;
beforeEach(function(done) {
emailDao.openFolder({
folder: {
path: 'INBOX'
}
}, function(err) {
expect(err).to.not.exist;
currentFolder = emailDao._account.folders.filter(function(folder) {
return folder.path === 'INBOX';
}).pop();
expect(currentFolder).to.exist;
done();
});
sinon.stub(smtpServer, 'onmail', function(mail) {
setTimeout(function() {
imapServer.appendMessage(currentFolder.path, [], false, mail.body);
}, 1000);
});
});
afterEach(function() {
smtpServer.onmail.restore();
});
it('should send & receive a signed plaintext message', function(done) {
var expectedBody = "asdasdasdasdasdasdasdasdasdasdasdasd asdasdasdasdasdasdasdasdasdasdasdasd asdasdasdasdasdasdasdasdasdasdasdasd asdasdasdasdasdasdasdasdasdasdasdasd asdasdasdasdasdasdasdasdasdasdasdasd asdasdasdasdasdasdasdasdasdasdasdasd asdasdasdasdasdasdasdasdasdasdasdasd asdasdasdasdasdasdasdasdasdasdasdasd asdasdasdasdasdasdasdasdasdasdasdasd asdasdasdasdasdasdasdasdasdasdasdasd asdasdasdasdasdasdasdasdasdasdasdasd ";
emailDao.onIncomingMessage = function() {
emailDao.onIncomingMessage = function(messages) {
emailDao.getBody({
folder: currentFolder,
message: messages[0]
}, function(err, message) {
expect(err).to.not.exist;
expect(message.encrypted).to.be.false;
expect(message.signed).to.be.true;
expect(message.signaturesValid).to.be.true;
expect(message.attachments.length).to.equal(0);
expect(message.body).to.equal(expectedBody);
done();
});
};
emailDao.sendPlaintext({
smtpclient: smtpClient,
email: {
from: [testAccount.user],
to: [testAccount.user],
subject: 'plaintext test',
body: expectedBody
}
}, function(err) {
expect(err).to.not.exist;
});
};
});
});
});
});