mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-25 06:55:45 +00:00
test_lib.py fixed error, adopting verification for tarantool
This commit is contained in:
parent
d1dd531bcd
commit
c51ede7d1e
@ -306,17 +306,27 @@ def test_delete_one_unspent_outputs(b, utxoset):
|
|||||||
|
|
||||||
@pytest.mark.bdb
|
@pytest.mark.bdb
|
||||||
def test_delete_many_unspent_outputs(b, utxoset):
|
def test_delete_many_unspent_outputs(b, utxoset):
|
||||||
|
from planetmint.backend.tarantool.connection import TarantoolDB
|
||||||
unspent_outputs, utxo_collection = utxoset
|
unspent_outputs, utxo_collection = utxoset
|
||||||
delete_res = b.delete_unspent_outputs(*unspent_outputs[::2])
|
delete_res = b.delete_unspent_outputs(*unspent_outputs[::2])
|
||||||
assert len(list(delete_res)) == 2
|
if not isinstance(b.connection, TarantoolDB):
|
||||||
# assert utxo_collection.count_documents(
|
assert len(list(delete_res)) == 2
|
||||||
# {'$or': [
|
assert utxo_collection.count_documents(
|
||||||
# {'transaction_id': 'a', 'output_index': 0},
|
{'$or': [
|
||||||
# {'transaction_id': 'b', 'output_index': 0},
|
{'transaction_id': 'a', 'output_index': 0},
|
||||||
# ]}
|
{'transaction_id': 'b', 'output_index': 0},
|
||||||
# ) == 0
|
]}
|
||||||
# assert utxo_collection.count_documents(
|
) == 0
|
||||||
# {'transaction_id': 'a', 'output_index': 1}) == 1
|
assert utxo_collection.count_documents(
|
||||||
|
{'transaction_id': 'a', 'output_index': 1}) == 1
|
||||||
|
else: # TODO It looks ugly because query.get_unspent_outputs function, has not yet implemented query parameter.
|
||||||
|
utx_space = b.connection.space("utxos")
|
||||||
|
res1 = utx_space.select(['a', 0], index="id_search").data
|
||||||
|
res2 = utx_space.select(['b', 0], index="id_search").data
|
||||||
|
assert len(res1) + len(res2) == 0
|
||||||
|
res3 = utx_space.select([], index="id_search").data
|
||||||
|
assert len(res3) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.bdb
|
@pytest.mark.bdb
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user