remove debug func

This commit is contained in:
Ivan Socolsky 2015-02-26 13:08:11 -03:00
parent 98a8723311
commit 2326fa2988
2 changed files with 36 additions and 20 deletions

View File

@ -64,7 +64,7 @@ ExpressApp.start = function(opts) {
var status = (err.code == 'NOTAUTHORIZED') ? 401 : 400; var status = (err.code == 'NOTAUTHORIZED') ? 401 : 400;
if (!opts.disableLogs) if (!opts.disableLogs)
log.info('Client Err: ' + status + ' ' + req.url + ' ' + err); log.info('Client Err: ' + status + ' ' + req.url + ' ' + err);
res.status(status).json({ res.status(status).json({
code: err.code, code: err.code,
@ -273,15 +273,6 @@ ExpressApp.start = function(opts) {
}); });
}); });
// TODO: DEBUG only!
router.get('/v1/dump', function(req, res) {
var server = WalletService.getInstance();
server.storage._dump(function() {
res.end();
});
});
app.use(opts.basePath || '/copay/api', router); app.use(opts.basePath || '/copay/api', router);
return app; return app;
}; };

View File

@ -84,13 +84,11 @@ fsmock._set = function(name, data) {
return content[name] = data; return content[name] = data;
}; };
var blockExplorerMock = {}; var blockExplorerMock = {};
blockExplorerMock.utxos = []; blockExplorerMock.utxos = [];
blockExplorerMock.getUnspentUtxos = function(dummy, cb) { blockExplorerMock.getUnspentUtxos = function(dummy, cb) {
var ret = _.map(blockExplorerMock.utxos || [], function(x) { var ret = _.map(blockExplorerMock.utxos || [], function(x) {
var y = _.clone(x); var y = _.clone(x);
@ -112,7 +110,6 @@ blockExplorerMock.setUtxo = function(address, amount, m) {
}); });
}; };
blockExplorerMock.broadcast = function(raw, cb) { blockExplorerMock.broadcast = function(raw, cb) {
blockExplorerMock.lastBroadcasted = raw; blockExplorerMock.lastBroadcasted = raw;
return cb(null, (new Bitcore.Transaction(raw)).id); return cb(null, (new Bitcore.Transaction(raw)).id);
@ -122,6 +119,8 @@ blockExplorerMock.reset = function() {
blockExplorerMock.utxos = []; blockExplorerMock.utxos = [];
}; };
describe('client API ', function() { describe('client API ', function() {
var clients, app; var clients, app;
@ -217,10 +216,8 @@ describe('client API ', function() {
done(); done();
}); });
}); });
}); });
describe('Storage Encryption', function() { describe('Storage Encryption', function() {
beforeEach(function() { beforeEach(function() {
_.each(_.range(3), function(i) { _.each(_.range(3), function(i) {
@ -326,7 +323,6 @@ describe('client API ', function() {
it.skip('should not ask for password if not needed (readwrite)', function(done) {}); it.skip('should not ask for password if not needed (readwrite)', function(done) {});
}); });
describe('Wallet Creation', function() { describe('Wallet Creation', function() {
it('should check balance in a 1-1 ', function(done) { it('should check balance in a 1-1 ', function(done) {
helpers.createAndJoinWallet(clients, 1, 1, function(err) { helpers.createAndJoinWallet(clients, 1, 1, function(err) {
@ -563,6 +559,7 @@ describe('client API ', function() {
}); });
}); });
}); });
describe('Air gapped related flows', function() { describe('Air gapped related flows', function() {
it('should be able get Tx proposals from a file', function(done) { it('should be able get Tx proposals from a file', function(done) {
helpers.createAndJoinWallet(clients, 1, 2, function(err, w) { helpers.createAndJoinWallet(clients, 1, 2, function(err, w) {
@ -823,10 +820,8 @@ describe('client API ', function() {
}); });
}); });
}); });
}); });
describe('Wallet Backups and Mobility', function() { describe('Wallet Backups and Mobility', function() {
it('round trip #import #export', function(done) { it('round trip #import #export', function(done) {
@ -869,9 +864,8 @@ describe('client API ', function() {
}); });
}); });
describe('Transaction Proposals Creation and Locked funds', function() { describe('Transaction Proposals Creation and Locked funds', function() {
it('Should lock and release funds', function(done) { it('Should lock and release funds through rejection', function(done) {
helpers.createAndJoinWallet(clients, 2, 2, function(err, w) { helpers.createAndJoinWallet(clients, 2, 2, function(err, w) {
clients[0].createAddress(function(err, x0) { clients[0].createAddress(function(err, x0) {
should.not.exist(err); should.not.exist(err);
@ -902,6 +896,37 @@ describe('client API ', function() {
}); });
}); });
}); });
it('Should lock and release funds through removal', function(done) {
helpers.createAndJoinWallet(clients, 2, 2, function(err, w) {
clients[0].createAddress(function(err, x0) {
should.not.exist(err);
should.exist(x0.address);
blockExplorerMock.setUtxo(x0, 1, 2);
blockExplorerMock.setUtxo(x0, 1, 2);
var opts = {
amount: 120000000,
toAddress: 'n2TBMPzPECGUfcT2EByiTJ12TPZkhN2mN5',
message: 'hello 1-1',
};
clients[0].sendTxProposal(opts, function(err, x) {
should.not.exist(err);
clients[0].sendTxProposal(opts, function(err, y) {
err.code.should.contain('INSUFFICIENTFUNDS');
clients[0].removeTxProposal(x, function(err) {
should.not.exist(err);
clients[0].sendTxProposal(opts, function(err, x) {
should.not.exist(err);
done();
});
});
});
});
});
});
});
it('Should keep message and refusal texts', function(done) { it('Should keep message and refusal texts', function(done) {
helpers.createAndJoinWallet(clients, 2, 3, function(err, w) { helpers.createAndJoinWallet(clients, 2, 3, function(err, w) {
clients[0].createAddress(function(err, x0) { clients[0].createAddress(function(err, x0) {