1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-26 02:42:17 -05:00

[WO-455] add test to provoque openpgp clearsigned message bug

https://github.com/openpgpjs/openpgpjs/issues/243
This commit is contained in:
Felix Hammerl 2014-07-08 19:17:56 +02:00
parent 1ead2d146d
commit 63980eb7ac

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;
});
};
});
});
});
});