1
0
mirror of https://github.com/moparisthebest/mail synced 2024-12-22 07:18:49 -05:00

Merge pull request #261 from whiteout-io/dev/WO-878

[WO-878] Do not force import of private key for HKP keys
This commit is contained in:
Tankred Hase 2015-02-04 11:27:11 +01:00
commit 274c23ea4c
2 changed files with 25 additions and 7 deletions

View File

@ -51,7 +51,7 @@ var LoginCtrl = function($scope, $timeout, $location, updateHandler, account, au
}); });
}); });
} else if (availableKeys && availableKeys.publicKey && !availableKeys.privateKey) { } else if (availableKeys && availableKeys.publicKey && !availableKeys.publicKey.source && !availableKeys.privateKey) {
// check if private key is synced // check if private key is synced
return keychain.requestPrivateKeyDownload({ return keychain.requestPrivateKeyDownload({
userId: availableKeys.publicKey.userId, userId: availableKeys.publicKey.userId,

View File

@ -86,7 +86,7 @@ describe('Login Controller unit test', function() {
authMock.getEmailAddress.returns(resolves({})); authMock.getEmailAddress.returns(resolves({}));
scope.init().then(function() { scope.init().then(function() {
expect(goToStub.withArgs('/add-account').called).to.be.true; expect(goToStub.calledWith('/add-account')).to.be.true;
expect(goToStub.calledOnce).to.be.true; expect(goToStub.calledOnce).to.be.true;
done(); done();
}); });
@ -104,7 +104,7 @@ describe('Login Controller unit test', function() {
emailMock.unlock.returns(rejects(new Error())); emailMock.unlock.returns(rejects(new Error()));
scope.init().then(function() { scope.init().then(function() {
expect(goToStub.withArgs('/login-existing').called).to.be.true; expect(goToStub.calledWith('/login-existing')).to.be.true;
expect(goToStub.calledOnce).to.be.true; expect(goToStub.calledOnce).to.be.true;
expect(authMock.storeCredentials.called).to.be.false; expect(authMock.storeCredentials.called).to.be.false;
done(); done();
@ -142,7 +142,7 @@ describe('Login Controller unit test', function() {
authMock.storeCredentials.returns(resolves()); authMock.storeCredentials.returns(resolves());
scope.init().then(function() { scope.init().then(function() {
expect(goToStub.withArgs('/account').called).to.be.true; expect(goToStub.calledWith('/account')).to.be.true;
expect(goToStub.calledOnce).to.be.true; expect(goToStub.calledOnce).to.be.true;
done(); done();
}); });
@ -175,7 +175,7 @@ describe('Login Controller unit test', function() {
keychainMock.requestPrivateKeyDownload.returns(resolves(true)); keychainMock.requestPrivateKeyDownload.returns(resolves(true));
scope.init().then(function() { scope.init().then(function() {
expect(goToStub.withArgs('/login-privatekey-download').called).to.be.true; expect(goToStub.calledWith('/login-privatekey-download')).to.be.true;
expect(goToStub.calledOnce).to.be.true; expect(goToStub.calledOnce).to.be.true;
done(); done();
}); });
@ -192,7 +192,25 @@ describe('Login Controller unit test', function() {
keychainMock.requestPrivateKeyDownload.returns(resolves()); keychainMock.requestPrivateKeyDownload.returns(resolves());
scope.init().then(function() { scope.init().then(function() {
expect(goToStub.withArgs('/login-new-device').called).to.be.true; expect(goToStub.calledWith('/login-new-device')).to.be.true;
expect(goToStub.calledOnce).to.be.true;
done();
});
});
it('should redirect to /login-new-device', function(done) {
authMock.init.returns(resolves());
authMock.getEmailAddress.returns(resolves({
emailAddress: emailAddress
}));
accountMock.init.returns(resolves({
publicKey: {
source: 'foo'
}
}));
scope.init().then(function() {
expect(goToStub.calledWith('/login-initial')).to.be.true;
expect(goToStub.calledOnce).to.be.true; expect(goToStub.calledOnce).to.be.true;
done(); done();
}); });
@ -206,7 +224,7 @@ describe('Login Controller unit test', function() {
accountMock.init.returns(resolves({})); accountMock.init.returns(resolves({}));
scope.init().then(function() { scope.init().then(function() {
expect(goToStub.withArgs('/login-initial').called).to.be.true; expect(goToStub.calledWith('/login-initial')).to.be.true;
expect(goToStub.calledOnce).to.be.true; expect(goToStub.calledOnce).to.be.true;
done(); done();
}); });