From 8b89c08237069f77c343eb54e3a01f45f670596e Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Sat, 21 Feb 2015 20:34:44 -0300 Subject: [PATCH] add tests --- test/integration/clientApi.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/integration/clientApi.js b/test/integration/clientApi.js index d5b3d39..e11ddd9 100644 --- a/test/integration/clientApi.js +++ b/test/integration/clientApi.js @@ -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) {