Merge pull request #136 from roninx991/tarantool

Fixes some test cases in tendermint/test_lib.py
This commit is contained in:
Lorenz Herzberger 2022-06-09 11:39:01 +02:00 committed by GitHub
commit 350364fccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -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

View File

@ -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