Problem: changed the return type of get_transaction_filtered

Solution: return tx class instead of dict
This commit is contained in:
codegeschrei 2018-08-08 14:37:52 +02:00
parent c0cad540ab
commit 078e767abc
2 changed files with 6 additions and 4 deletions

View File

@ -262,8 +262,10 @@ class BigchainDB(object):
def get_transactions_filtered(self, asset_id, operation=None):
"""Get a list of transactions filtered on some criteria
"""
return backend.query.get_txids_filtered(self.connection, asset_id,
operation)
txids = backend.query.get_txids_filtered(self.connection, asset_id,
operation)
for txid in txids:
yield self.get_transaction(txid)
def get_outputs_filtered(self, owner, spent=None):
"""Get a list of output links filtered on some criteria

View File

@ -35,11 +35,11 @@ def txlist(b, user_pk, user2_pk, user_sk, user2_sk):
@pytest.mark.bdb
def test_get_txlist_by_asset(b, txlist):
res = b.get_transactions_filtered(txlist.create1.id)
assert sorted(set(tx for tx in res)) == sorted(
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.get_transactions_filtered(txlist.create1.id, operation='CREATE')
assert set(tx for tx in res) == {txlist.create1.id}
assert set(tx.id for tx in res) == {txlist.create1.id}