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;
if (!opts.disableLogs)
log.info('Client Err: ' + status + ' ' + req.url + ' ' + err);
log.info('Client Err: ' + status + ' ' + req.url + ' ' + err);
res.status(status).json({
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);
return app;
};

View File

@ -84,13 +84,11 @@ fsmock._set = function(name, data) {
return content[name] = data;
};
var blockExplorerMock = {};
blockExplorerMock.utxos = [];
blockExplorerMock.getUnspentUtxos = function(dummy, cb) {
var ret = _.map(blockExplorerMock.utxos || [], function(x) {
var y = _.clone(x);
@ -112,7 +110,6 @@ blockExplorerMock.setUtxo = function(address, amount, m) {
});
};
blockExplorerMock.broadcast = function(raw, cb) {
blockExplorerMock.lastBroadcasted = raw;
return cb(null, (new Bitcore.Transaction(raw)).id);
@ -122,6 +119,8 @@ blockExplorerMock.reset = function() {
blockExplorerMock.utxos = [];
};
describe('client API ', function() {
var clients, app;
@ -217,10 +216,8 @@ describe('client API ', function() {
done();
});
});
});
describe('Storage Encryption', function() {
beforeEach(function() {
_.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) {});
});
describe('Wallet Creation', function() {
it('should check balance in a 1-1 ', function(done) {
helpers.createAndJoinWallet(clients, 1, 1, function(err) {
@ -563,6 +559,7 @@ describe('client API ', function() {
});
});
});
describe('Air gapped related flows', function() {
it('should be able get Tx proposals from a file', function(done) {
helpers.createAndJoinWallet(clients, 1, 2, function(err, w) {
@ -823,10 +820,8 @@ describe('client API ', function() {
});
});
});
});
describe('Wallet Backups and Mobility', function() {
it('round trip #import #export', function(done) {
@ -869,9 +864,8 @@ describe('client API ', 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) {
clients[0].createAddress(function(err, x0) {
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) {
helpers.createAndJoinWallet(clients, 2, 3, function(err, w) {
clients[0].createAddress(function(err, x0) {