mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Problem: Big blocks of commented out code have been around for months
Solution: Removed the dead code
This commit is contained in:
parent
2d1f670eec
commit
f66f30f4cb
@ -98,22 +98,6 @@ class BigchainDB(object):
|
|||||||
return (500, 'Internal error')
|
return (500, 'Internal error')
|
||||||
|
|
||||||
return (202, '')
|
return (202, '')
|
||||||
# result = response['result']
|
|
||||||
# if mode == self.mode_list[2]:
|
|
||||||
# return self._process_commit_mode_response(result)
|
|
||||||
# else:
|
|
||||||
# status_code = result['code']
|
|
||||||
# return self._process_status_code(status_code,
|
|
||||||
# 'Error while processing transaction')
|
|
||||||
|
|
||||||
# def _process_commit_mode_response(self, result):
|
|
||||||
# check_tx_status_code = result['check_tx']['code']
|
|
||||||
# if check_tx_status_code == 0:
|
|
||||||
# deliver_tx_status_code = result['deliver_tx']['code']
|
|
||||||
# return self._process_status_code(deliver_tx_status_code,
|
|
||||||
# 'Error while commiting the transaction')
|
|
||||||
# else:
|
|
||||||
# return (500, 'Error while validating the transaction')
|
|
||||||
|
|
||||||
def process_status_code(self, status_code, failure_msg):
|
def process_status_code(self, status_code, failure_msg):
|
||||||
return (202, '') if status_code == 0 else (500, failure_msg)
|
return (202, '') if status_code == 0 else (500, failure_msg)
|
||||||
|
|||||||
@ -84,13 +84,6 @@ def test_deliver_tx__valid_create_updates_db(b, init_chain_request):
|
|||||||
app.commit()
|
app.commit()
|
||||||
assert b.get_transaction(tx.id).id == tx.id
|
assert b.get_transaction(tx.id).id == tx.id
|
||||||
|
|
||||||
# unspent_outputs = b.get_unspent_outputs()
|
|
||||||
# unspent_output = next(unspent_outputs)
|
|
||||||
# expected_unspent_output = next(tx.unspent_outputs)._asdict()
|
|
||||||
# assert unspent_output == expected_unspent_output
|
|
||||||
# with pytest.raises(StopIteration):
|
|
||||||
# next(unspent_outputs)
|
|
||||||
|
|
||||||
|
|
||||||
def test_deliver_tx__double_spend_fails(b, init_chain_request):
|
def test_deliver_tx__double_spend_fails(b, init_chain_request):
|
||||||
from bigchaindb import App
|
from bigchaindb import App
|
||||||
|
|||||||
@ -195,12 +195,6 @@ def test_store_transaction(mocker, b, signed_create_tx,
|
|||||||
mocked_store_transaction = mocker.patch(
|
mocked_store_transaction = mocker.patch(
|
||||||
'bigchaindb.backend.query.store_transactions')
|
'bigchaindb.backend.query.store_transactions')
|
||||||
b.store_bulk_transactions([signed_create_tx])
|
b.store_bulk_transactions([signed_create_tx])
|
||||||
# mongo_client = MongoClient(host=db_context.host, port=db_context.port)
|
|
||||||
# utxoset = mongo_client[db_context.name]['utxos']
|
|
||||||
# assert utxoset.count() == 1
|
|
||||||
# utxo = utxoset.find_one()
|
|
||||||
# assert utxo['transaction_id'] == signed_create_tx.id
|
|
||||||
# assert utxo['output_index'] == 0
|
|
||||||
|
|
||||||
mocked_store_asset.assert_called_once_with(
|
mocked_store_asset.assert_called_once_with(
|
||||||
b.connection,
|
b.connection,
|
||||||
@ -219,10 +213,7 @@ def test_store_transaction(mocker, b, signed_create_tx,
|
|||||||
mocked_store_metadata.reset_mock()
|
mocked_store_metadata.reset_mock()
|
||||||
mocked_store_transaction.reset_mock()
|
mocked_store_transaction.reset_mock()
|
||||||
b.store_bulk_transactions([signed_transfer_tx])
|
b.store_bulk_transactions([signed_transfer_tx])
|
||||||
# assert utxoset.count() == 1
|
|
||||||
# utxo = utxoset.find_one()
|
|
||||||
# assert utxo['transaction_id'] == signed_transfer_tx.id
|
|
||||||
# assert utxo['output_index'] == 0
|
|
||||||
assert not mocked_store_asset.called
|
assert not mocked_store_asset.called
|
||||||
mocked_store_metadata.asser_called_once_with(
|
mocked_store_metadata.asser_called_once_with(
|
||||||
b.connection,
|
b.connection,
|
||||||
@ -245,12 +236,7 @@ def test_store_bulk_transaction(mocker, b, signed_create_tx,
|
|||||||
mocked_store_transactions = mocker.patch(
|
mocked_store_transactions = mocker.patch(
|
||||||
'bigchaindb.backend.query.store_transactions')
|
'bigchaindb.backend.query.store_transactions')
|
||||||
b.store_bulk_transactions((signed_create_tx,))
|
b.store_bulk_transactions((signed_create_tx,))
|
||||||
# mongo_client = MongoClient(host=db_context.host, port=db_context.port)
|
|
||||||
# utxoset = mongo_client[db_context.name]['utxos']
|
|
||||||
# assert utxoset.count() == 1
|
|
||||||
# utxo = utxoset.find_one()
|
|
||||||
# assert utxo['transaction_id'] == signed_create_tx.id
|
|
||||||
# assert utxo['output_index'] == 0
|
|
||||||
mocked_store_assets.assert_called_once_with(
|
mocked_store_assets.assert_called_once_with(
|
||||||
b.connection,
|
b.connection,
|
||||||
[{'id': signed_create_tx.id, 'data': signed_create_tx.asset['data']}],
|
[{'id': signed_create_tx.id, 'data': signed_create_tx.asset['data']}],
|
||||||
@ -268,10 +254,7 @@ def test_store_bulk_transaction(mocker, b, signed_create_tx,
|
|||||||
mocked_store_metadata.reset_mock()
|
mocked_store_metadata.reset_mock()
|
||||||
mocked_store_transactions.reset_mock()
|
mocked_store_transactions.reset_mock()
|
||||||
b.store_bulk_transactions((signed_transfer_tx,))
|
b.store_bulk_transactions((signed_transfer_tx,))
|
||||||
# assert utxoset.count() == 1
|
|
||||||
# utxo = utxoset.find_one()
|
|
||||||
# assert utxo['transaction_id'] == signed_transfer_tx.id
|
|
||||||
# assert utxo['output_index'] == 0
|
|
||||||
assert not mocked_store_assets.called
|
assert not mocked_store_assets.called
|
||||||
mocked_store_metadata.asser_called_once_with(
|
mocked_store_metadata.asser_called_once_with(
|
||||||
b.connection,
|
b.connection,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user