mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 22:45:44 +00:00
Fixes some test cases in tendermint/test_lib.py
This commit is contained in:
parent
36d9b41d0e
commit
4ca2c53cb7
@ -552,7 +552,7 @@ def tarantool_client(db_context): # TODO Here add TarantoolConnectionClass
|
||||
#
|
||||
|
||||
@pytest.fixture
|
||||
def utxo_collection(tarantool_client):
|
||||
def utxo_collection(tarantool_client, _setup_database):
|
||||
return tarantool_client.get_space("utxos")
|
||||
|
||||
|
||||
@ -568,10 +568,12 @@ def dummy_unspent_outputs():
|
||||
@pytest.fixture
|
||||
def utxoset(dummy_unspent_outputs, utxo_collection):
|
||||
from json import dumps
|
||||
num_rows_before_operation = utxo_collection.select().rowcount
|
||||
for utxo in dummy_unspent_outputs:
|
||||
res = utxo_collection.insert((utxo["transaction_id"], utxo["output_index"], dumps(utxo)))
|
||||
assert res
|
||||
assert len(utxo_collection.select()) == 3
|
||||
num_rows_after_operation = utxo_collection.select().rowcount
|
||||
assert num_rows_after_operation == num_rows_before_operation + 3
|
||||
return dummy_unspent_outputs, utxo_collection
|
||||
|
||||
|
||||
|
||||
@ -288,9 +288,11 @@ def test_store_bulk_transaction(mocker, b, signed_create_tx,
|
||||
@pytest.mark.bdb
|
||||
def test_delete_zero_unspent_outputs(b, utxoset):
|
||||
unspent_outputs, utxo_collection = utxoset
|
||||
num_rows_before_operation = utxo_collection.select().rowcount
|
||||
delete_res = b.delete_unspent_outputs()
|
||||
num_rows_after_operation = utxo_collection.select().rowcount
|
||||
# assert delete_res is None
|
||||
assert utxo_collection.select().rowcount == 3
|
||||
assert num_rows_before_operation == num_rows_after_operation
|
||||
# assert utxo_collection.count_documents(
|
||||
# {'$or': [
|
||||
# {'transaction_id': 'a', 'output_index': 0},
|
||||
@ -350,9 +352,11 @@ def test_delete_many_unspent_outputs(b, utxoset):
|
||||
|
||||
@pytest.mark.bdb
|
||||
def test_store_zero_unspent_output(b, utxo_collection):
|
||||
num_rows_before_operation = utxo_collection.select().rowcount
|
||||
res = b.store_unspent_outputs()
|
||||
num_rows_after_operation = utxo_collection.select().rowcount
|
||||
assert res is None
|
||||
assert utxo_collection.select().rowcount == 0
|
||||
assert num_rows_before_operation == num_rows_after_operation
|
||||
|
||||
|
||||
@pytest.mark.bdb
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user