rename setPassphrase

This commit is contained in:
Matias Alejo Garcia 2014-09-18 16:15:23 -03:00
commit 56a7a7b5c5
7 changed files with 29 additions and 29 deletions

View file

@ -69,7 +69,7 @@ describe('PayPro (in Wallet) model', function() {
});
var storage = new Storage(walletConfig.storage);
storage.setPassphrase('xxx');
storage.setPassword('xxx');
var network = new Network(walletConfig.network);
var blockchain = new Blockchain(walletConfig.blockchain);
c.storage = storage;

View file

@ -13,7 +13,7 @@ describe('Storage model', function() {
var s;
beforeEach(function() {
s = new Storage(require('./mocks/FakeLocalStorage').storageParams);
s.setPassphrase('mysupercoolpassword');
s.setPassword('mysupercoolpassword');
s.storage.clear();
s.sessionStorage.clear();
});
@ -251,13 +251,13 @@ describe('Storage model', function() {
describe('#import', function() {
it('should not be able to decrypt with wrong password', function() {
s.setPassphrase('xxx');
s.setPassword('xxx');
var wo = s.import(encryptedLegacy1);
should.not.exist(wo);
});
it('should be able to decrypt an old backup', function() {
s.setPassphrase(legacyPassword1);
s.setPassword(legacyPassword1);
var wo = s.import(encryptedLegacy1);
should.exist(wo);
wo.opts.id.should.equal('48ba2f1ffdfe9708');

View file

@ -82,7 +82,7 @@ describe('Wallet model', function() {
});
var storage = new Storage(walletConfig.storage);
storage.setPassphrase('xxx');
storage.setPassword('xxx');
var network = new Network(walletConfig.network);
var blockchain = new Blockchain(walletConfig.blockchain);
c.storage = storage;
@ -344,7 +344,7 @@ describe('Wallet model', function() {
o.opts.reconnectDelay = 100;
var s = new Storage(walletConfig.storage);
s.setPassphrase('xxx');
s.setPassword('xxx');
var w2 = Wallet.fromObj(o,
s,
new Network(walletConfig.network),

View file

@ -34,7 +34,7 @@ describe('WalletFactory model', function() {
beforeEach(function() {
wf = new WalletFactory(config, '0.0.1');
wf.storage.setPassphrase = sinon.spy();
wf.storage.setPassword = sinon.spy();
wf.storage.getSessionId = sinon.spy();
wf.storage.setFromObj = sinon.spy();
wf.storage.setLastOpened = sinon.stub().yields(null);
@ -151,15 +151,15 @@ describe('WalletFactory model', function() {
describe('#fromEncryptedObj', function() {
it('should create wallet from encrypted object', function() {
wf.storage.setPassphrase = sinon.spy();
wf.storage.setPassword = sinon.spy();
wf.storage.import = sinon.stub().withArgs('base64').returns('walletObj');
wf.fromObj = sinon.stub().withArgs('walletObj').returns('ok');
var w = wf.fromEncryptedObj("encrypted object", "123");
w.should.equal('ok');
wf.storage.setPassphrase.calledOnce.should.be.true;
wf.storage.setPassphrase.getCall(0).args[0].should.equal('123');
wf.storage.setPassword.calledOnce.should.be.true;
wf.storage.setPassword.getCall(0).args[0].should.equal('123');
wf.storage.import.calledOnce.should.be.true;
wf.fromObj.calledWith('walletObj').should.be.true;
});
@ -291,9 +291,9 @@ describe('WalletFactory model', function() {
'totalcopayers': 3
};
it('should call setPassphrase', function(done) {
it('should call setPassword', function(done) {
var wf = new WalletFactory(config, '0.0.1');
wf.storage.setPassphrase = sinon.spy();
wf.storage.setPassword = sinon.spy();
var s1 = sinon.stub();
s1.store = sinon.stub().yields(null);
@ -301,15 +301,15 @@ describe('WalletFactory model', function() {
wf.storage.setLastOpened = sinon.stub().yields(null);
wf.open('dummy', 'xxx', function(err, w) {
wf.storage.setPassphrase.calledOnce.should.equal(true);
wf.storage.setPassphrase.getCall(0).args[0].should.equal('xxx');
wf.storage.setPassword.calledOnce.should.equal(true);
wf.storage.setPassword.getCall(0).args[0].should.equal('xxx');
done();
});
});
it('should call return wallet', function(done) {
var wf = new WalletFactory(config, '0.0.1');
wf.storage.setPassphrase = sinon.spy();
wf.storage.setPassword = sinon.spy();
var s1 = sinon.stub();
s1.store = sinon.stub().yields(null);
@ -326,7 +326,7 @@ describe('WalletFactory model', function() {
it('should call #store', function(done) {
var wf = new WalletFactory(config, '0.0.1');
wf.storage.setPassphrase = sinon.spy();
wf.storage.setPassword = sinon.spy();
var s1 = sinon.stub();
s1.store = sinon.stub().yields(null);
@ -341,7 +341,7 @@ describe('WalletFactory model', function() {
it('should call #setLastOpened', function(done) {
var wf = new WalletFactory(config, '0.0.1');
wf.storage.setPassphrase = sinon.spy();
wf.storage.setPassword = sinon.spy();
var s1 = sinon.stub();
s1.store = sinon.stub().yields(null);
@ -510,13 +510,13 @@ describe('WalletFactory model', function() {
it('should be able to import simple 1-of-1 encrypted legacy testnet wallet', function() {
wf.storage.import = sinon.stub();
wf.storage.setPassphrase = sinon.spy();
wf.storage.setPassword = sinon.spy();
wf.storage.import.withArgs('dummy').returns(JSON.parse(legacy1));
var w = wf.import('dummy', 'xxx');
should.exist(w);
wf.storage.setPassphrase.calledOnce.should.equal(true);
wf.storage.setPassphrase.getCall(0).args[0].should.equal('xxx');
wf.storage.setPassword.calledOnce.should.equal(true);
wf.storage.setPassword.getCall(0).args[0].should.equal('xxx');
w.isReady().should.equal(true);
var wo = w.toObj();

View file

@ -21,7 +21,7 @@ describe('WalletLock model', function() {
beforeEach(function() {
storage = new Storage(require('./mocks/FakeLocalStorage').storageParams);
storage.setPassphrase('mysupercoolpassword');
storage.setPassword('mysupercoolpassword');
storage.storage.clear();
storage.sessionStorage.clear();
});