add tests

This commit is contained in:
Matias Alejo Garcia 2015-02-21 20:34:44 -03:00
parent 7dba50faad
commit 8b89c08237
1 changed files with 20 additions and 0 deletions

View File

@ -81,6 +81,9 @@ fsmock.reset = function() {
fsmock._get = function(name) {
return content[name];
};
fsmock._set = function(name, data) {
return content[name] = data;
};
var blockExplorerMock = {};
@ -274,6 +277,23 @@ describe('client API ', function() {
});
});
describe('Access control', function() {
it('should not be able to create address if not rwPubKey', function(done) {
helpers.createAndJoinWallet(clients, 1, 1, function(err) {
should.not.exist(err);
var data = JSON.parse(fsmock._get('client0'));
delete data.rwPrivKey;
fsmock._set('client0', JSON.stringify(data));
data.rwPrivKey = null;
clients[0].createAddress(function(err, x0) {
err.code.should.equal('NOTAUTHORIZED');
done();
});
});
});
});
describe('Address Creation', function() {
it('should be able to create address in all copayers in a 2-3 wallet', function(done) {