mirror of https://github.com/moparisthebest/mail
Hide error msg if public key verification does nto work
This commit is contained in:
parent
9841a59a9e
commit
d0f002bfd1
|
@ -30,7 +30,7 @@ var PublicKeyVerifierCtrl = function($scope, $location, $q, $timeout, $interval,
|
||||||
return success();
|
return success();
|
||||||
|
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
$scope.errMsg = error.message + ' Retrying in ' + RETRY_INTERVAL / 1000 + ' seconds...'; // display error
|
$scope.errMsg = error.message; // display error
|
||||||
|
|
||||||
scheduleVerification(); // schedule next verification attempt
|
scheduleVerification(); // schedule next verification attempt
|
||||||
});
|
});
|
||||||
|
|
|
@ -95,7 +95,7 @@ PublickeyVerifier.prototype.verify = function() {
|
||||||
|
|
||||||
if (!verificationSuccessful) {
|
if (!verificationSuccessful) {
|
||||||
// nothing unexpected went wrong, but no public key could be verified
|
// nothing unexpected went wrong, but no public key could be verified
|
||||||
throw new Error('Could not verify public key.');
|
throw new Error();
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve(); // we're done
|
resolve(); // we're done
|
||||||
|
|
|
@ -94,6 +94,26 @@ describe('Public Key Verification Controller unit test', function() {
|
||||||
it('should not verify', function(done) {
|
it('should not verify', function(done) {
|
||||||
var credentials = {};
|
var credentials = {};
|
||||||
|
|
||||||
|
auth.getCredentials.returns(resolves(credentials));
|
||||||
|
verifier.configure.withArgs(credentials).returns(resolves());
|
||||||
|
verifier.verify.withArgs().returns(rejects(new Error()));
|
||||||
|
|
||||||
|
scope.verify().then(function() {
|
||||||
|
expect(auth.getCredentials.calledOnce).to.be.true;
|
||||||
|
expect(verifier.configure.calledOnce).to.be.true;
|
||||||
|
expect(verifier.verify.calledOnce).to.be.true;
|
||||||
|
expect(scope.errMsg).to.equal('');
|
||||||
|
|
||||||
|
clearTimeout(scope.timeout);
|
||||||
|
clearInterval(scope.countdownDecrement);
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not verify with error message', function(done) {
|
||||||
|
var credentials = {};
|
||||||
|
|
||||||
auth.getCredentials.returns(resolves(credentials));
|
auth.getCredentials.returns(resolves(credentials));
|
||||||
verifier.configure.withArgs(credentials).returns(resolves());
|
verifier.configure.withArgs(credentials).returns(resolves());
|
||||||
verifier.verify.withArgs().returns(rejects(new Error('foo')));
|
verifier.verify.withArgs().returns(rejects(new Error('foo')));
|
||||||
|
|
|
@ -191,7 +191,7 @@ describe('Public-Key Verifier', function() {
|
||||||
|
|
||||||
// run the test
|
// run the test
|
||||||
verifier.verify().catch(function(error) {
|
verifier.verify().catch(function(error) {
|
||||||
expect(error.message).to.equal('Could not verify public key');
|
expect(error.message).to.equal('');
|
||||||
|
|
||||||
// verification
|
// verification
|
||||||
expect(imapStub.login.callCount).to.equal(1);
|
expect(imapStub.login.callCount).to.equal(1);
|
||||||
|
|
Loading…
Reference in New Issue