mirror of
https://github.com/planetmint/planetmint.git
synced 2025-03-30 15:08:31 +00:00

* created ABCI_RPC class to seperate RPC interaction from the other ABCI interactions * renamed validation.py to validator.py * simplified planetmint/__init__.py * moved methods used by testing to tests/utils.py * making planetmint/__init__.py lean * moved ProcessGroup object to tests as it is only used there * reintegrated disabled tests Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
48 lines
1.5 KiB
Python
48 lines
1.5 KiB
Python
# Copyright © 2020 Interplanetary Database Association e.V.,
|
|
# Planetmint and IPDB software contributors.
|
|
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
|
# Code is Apache-2.0 and docs are CC-BY-4.0
|
|
|
|
"""Test getting a list of transactions from the backend.
|
|
|
|
This test module defines it's own fixture which is used by all the tests.
|
|
"""
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def txlist(b, user_pk, user2_pk, user_sk, user2_sk):
|
|
from transactions.types.assets.create import Create
|
|
from transactions.types.assets.transfer import Transfer
|
|
|
|
# Create two CREATE transactions
|
|
create1 = Create.generate([user_pk], [([user2_pk], 6)]).sign([user_sk])
|
|
|
|
create2 = Create.generate([user2_pk], [([user2_pk], 5), ([user_pk], 5)]).sign([user2_sk])
|
|
|
|
# Create a TRANSFER transactions
|
|
transfer1 = Transfer.generate(create1.to_inputs(), [([user_pk], 8)], [create1.id]).sign([user2_sk])
|
|
|
|
b.models.store_bulk_transactions([create1, create2, transfer1])
|
|
|
|
return type(
|
|
"",
|
|
(),
|
|
{
|
|
"create1": create1,
|
|
"transfer1": transfer1,
|
|
},
|
|
)
|
|
|
|
|
|
@pytest.mark.bdb
|
|
def test_get_txlist_by_asset(b, txlist):
|
|
res = b.models.get_transactions_filtered([txlist.create1.id])
|
|
assert sorted(set(tx.id for tx in res)) == sorted(set([txlist.transfer1.id, txlist.create1.id]))
|
|
|
|
|
|
@pytest.mark.bdb
|
|
def test_get_txlist_by_operation(b, txlist):
|
|
res = b.models.get_transactions_filtered([txlist.create1.id], operation="CREATE")
|
|
assert set(tx.id for tx in res) == {txlist.create1.id}
|