From 7d0fc373ab2b9239a5c52051f74aadbfc34e4764 Mon Sep 17 00:00:00 2001 From: Felix Hammerl Date: Tue, 7 Jan 2014 19:23:03 +0100 Subject: [PATCH] [WO-183] key file export now proposes file name whiteout_mail_foo@bar.com_KEYIDKEYID.asc --- src/js/controller/account.js | 2 +- src/js/controller/login-initial.js | 2 +- test/new-unit/account-ctrl-test.js | 6 ++---- test/new-unit/login-initial-ctrl-test.js | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/js/controller/account.js b/src/js/controller/account.js index 95c8e85..5a9d13c 100644 --- a/src/js/controller/account.js +++ b/src/js/controller/account.js @@ -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', diff --git a/src/js/controller/login-initial.js b/src/js/controller/login-initial.js index 663bb4c..066d280 100644 --- a/src/js/controller/login-initial.js +++ b/src/js/controller/login-initial.js @@ -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); }); diff --git a/test/new-unit/account-ctrl-test.js b/test/new-unit/account-ctrl-test.js index 16826c3..061db06 100644 --- a/test/new-unit/account-ctrl-test.js +++ b/test/new-unit/account-ctrl-test.js @@ -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; diff --git a/test/new-unit/login-initial-ctrl-test.js b/test/new-unit/login-initial-ctrl-test.js index 9910dcd..c747f3f 100644 --- a/test/new-unit/login-initial-ctrl-test.js +++ b/test/new-unit/login-initial-ctrl-test.js @@ -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');