mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-25 15:05:49 +00:00
commit
3a7e4b2944
@ -552,7 +552,7 @@ def tarantool_client(db_context): # TODO Here add TarantoolConnectionClass
|
|||||||
#
|
#
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def utxo_collection(tarantool_client):
|
def utxo_collection(tarantool_client, _setup_database):
|
||||||
return tarantool_client.get_space("utxos")
|
return tarantool_client.get_space("utxos")
|
||||||
|
|
||||||
|
|
||||||
@ -568,10 +568,12 @@ def dummy_unspent_outputs():
|
|||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def utxoset(dummy_unspent_outputs, utxo_collection):
|
def utxoset(dummy_unspent_outputs, utxo_collection):
|
||||||
from json import dumps
|
from json import dumps
|
||||||
|
num_rows_before_operation = utxo_collection.select().rowcount
|
||||||
for utxo in dummy_unspent_outputs:
|
for utxo in dummy_unspent_outputs:
|
||||||
res = utxo_collection.insert((utxo["transaction_id"], utxo["output_index"], dumps(utxo)))
|
res = utxo_collection.insert((utxo["transaction_id"], utxo["output_index"], dumps(utxo)))
|
||||||
assert res
|
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
|
return dummy_unspent_outputs, utxo_collection
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -288,9 +288,11 @@ def test_store_bulk_transaction(mocker, b, signed_create_tx,
|
|||||||
@pytest.mark.bdb
|
@pytest.mark.bdb
|
||||||
def test_delete_zero_unspent_outputs(b, utxoset):
|
def test_delete_zero_unspent_outputs(b, utxoset):
|
||||||
unspent_outputs, utxo_collection = utxoset
|
unspent_outputs, utxo_collection = utxoset
|
||||||
|
num_rows_before_operation = utxo_collection.select().rowcount
|
||||||
delete_res = b.delete_unspent_outputs()
|
delete_res = b.delete_unspent_outputs()
|
||||||
|
num_rows_after_operation = utxo_collection.select().rowcount
|
||||||
# assert delete_res is None
|
# 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(
|
# assert utxo_collection.count_documents(
|
||||||
# {'$or': [
|
# {'$or': [
|
||||||
# {'transaction_id': 'a', 'output_index': 0},
|
# {'transaction_id': 'a', 'output_index': 0},
|
||||||
@ -350,9 +352,11 @@ def test_delete_many_unspent_outputs(b, utxoset):
|
|||||||
|
|
||||||
@pytest.mark.bdb
|
@pytest.mark.bdb
|
||||||
def test_store_zero_unspent_output(b, utxo_collection):
|
def test_store_zero_unspent_output(b, utxo_collection):
|
||||||
|
num_rows_before_operation = utxo_collection.select().rowcount
|
||||||
res = b.store_unspent_outputs()
|
res = b.store_unspent_outputs()
|
||||||
|
num_rows_after_operation = utxo_collection.select().rowcount
|
||||||
assert res is None
|
assert res is None
|
||||||
assert utxo_collection.select().rowcount == 0
|
assert num_rows_before_operation == num_rows_after_operation
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.bdb
|
@pytest.mark.bdb
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user