Merge pull request #1460 from cmgustavo/bug/01-import
Trying to import a wallet with a wrong password
This commit is contained in:
commit
c360fbb926
3 changed files with 8 additions and 8 deletions
|
|
@ -136,10 +136,7 @@ WalletFactory.prototype.fromEncryptedObj = function(base64, passphrase, skipFiel
|
||||||
*/
|
*/
|
||||||
WalletFactory.prototype.import = function(base64, passphrase, skipFields) {
|
WalletFactory.prototype.import = function(base64, passphrase, skipFields) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var w = self.fromEncryptedObj(base64, passphrase, skipFields);
|
return self.fromEncryptedObj(base64, passphrase, skipFields);
|
||||||
|
|
||||||
if (!w) throw new Error('Wrong passphrase');
|
|
||||||
return w;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -179,11 +179,11 @@ describe('WalletFactory model', function() {
|
||||||
|
|
||||||
should.exist(w);
|
should.exist(w);
|
||||||
wallet.should.equal(w);
|
wallet.should.equal(w);
|
||||||
|
});
|
||||||
|
it('should import with a wrong password', function() {
|
||||||
wf.fromEncryptedObj = sinon.stub().returns(null);
|
wf.fromEncryptedObj = sinon.stub().returns(null);
|
||||||
(function() {
|
var w = wf.import("encrypted", "passwordasdfasdf");
|
||||||
wf.import("encrypted", "password")
|
should.not.exist(w);
|
||||||
}).should.throw();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -457,6 +457,9 @@ describe("Unit: Controllers", function() {
|
||||||
it('should exist', function() {
|
it('should exist', function() {
|
||||||
should.exist(what);
|
should.exist(what);
|
||||||
});
|
});
|
||||||
|
it('import status', function() {
|
||||||
|
expect(scope.importStatus).equal('Importing wallet - Reading backup...');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Open Controller', function() {
|
describe('Open Controller', function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue