[WO-183] key file export now proposes file name whiteout_mail_foo@bar.com_KEYIDKEYID.asc

This commit is contained in:
Felix Hammerl 2014-01-07 19:23:03 +01:00
parent 8f366ffb75
commit 7d0fc373ab
4 changed files with 5 additions and 7 deletions

View File

@ -41,7 +41,7 @@ define(function(require) {
return;
}
var id = keys.keyId.substring(8, keys.keyId.length);
var id = 'whiteout_mail_' + emailDao._account.emailAddress + '_' + keys.keyId.substring(8, keys.keyId.length);
dl.createDownload({
content: keys.publicKeyArmored + keys.privateKeyArmored,
filename: id + '.asc',

View File

@ -61,7 +61,7 @@ define(function(require) {
var id = keys.keyId.substring(8, keys.keyId.length);
dl.createDownload({
content: keys.publicKeyArmored + keys.privateKeyArmored,
filename: id + '.asc',
filename: 'whiteout_mail_' + emailDao._account.emailAddress + '_' + id + '.asc',
contentType: 'text/plain'
}, onSave);
});

View File

@ -71,7 +71,7 @@ define(function(require) {
keyId: dummyKeyId
});
createDownloadMock.withArgs(sinon.match(function(arg) {
return arg.content === 'ab' && arg.filename === expectedKeyId + '.asc' && arg.contentType === 'text/plain';
return arg.content === 'ab' && arg.filename === 'whiteout_mail_' + emailAddress + '_' + expectedKeyId + '.asc' && arg.contentType === 'text/plain';
})).yields();
scope.onError = function() {
expect(cryptoMock.exportKeys.calledOnce).to.be.true;
@ -100,9 +100,7 @@ define(function(require) {
privateKeyArmored: 'b',
keyId: dummyKeyId
});
createDownloadMock.withArgs(sinon.match(function(arg) {
return arg.content === 'ab' && arg.filename === expectedKeyId + '.asc' && arg.contentType === 'text/plain';
})).yields(new Error('asdasd'));
createDownloadMock.withArgs().yields(new Error('asdasd'));
scope.onError = function() {
expect(cryptoMock.exportKeys.calledOnce).to.be.true;
expect(dl.createDownload.calledOnce).to.be.true;

View File

@ -133,7 +133,7 @@ define(function(require) {
keyId: keyId
});
createDownloadMock.withArgs(sinon.match(function(arg) {
return arg.content === 'ab' && arg.filename === expectedKeyId + '.asc' && arg.contentType === 'text/plain';
return arg.content === 'ab' && arg.filename === 'whiteout_mail_' + emailAddress + '_' + expectedKeyId + '.asc' && arg.contentType === 'text/plain';
})).yields();
locationSpy = sinon.spy(location, 'path');