mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 22:45:44 +00:00
fixed get block test case
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
adb85b7590
commit
10567fcc8d
@ -238,7 +238,7 @@ def get_block(connection, block_id=None):
|
|||||||
@register_query(TarantoolDBConnection)
|
@register_query(TarantoolDBConnection)
|
||||||
def get_block_with_transaction(connection, txid: str):
|
def get_block_with_transaction(connection, txid: str):
|
||||||
_block = connection.run(connection.space("blocks").select(txid, index="block_by_transaction_id"))
|
_block = connection.run(connection.space("blocks").select(txid, index="block_by_transaction_id"))
|
||||||
return _block[0] if len(_block) == 1 else []
|
return _block if len(_block) > 0 else []
|
||||||
|
|
||||||
|
|
||||||
@register_query(TarantoolDBConnection)
|
@register_query(TarantoolDBConnection)
|
||||||
|
|||||||
@ -59,8 +59,8 @@ def test_get_block_containing_transaction(b, client, alice):
|
|||||||
block = Block(app_hash="random_utxo", height=13, transactions=[tx.id])
|
block = Block(app_hash="random_utxo", height=13, transactions=[tx.id])
|
||||||
b.store_block(block._asdict())
|
b.store_block(block._asdict())
|
||||||
res = client.get("{}?transaction_id={}".format(BLOCKS_ENDPOINT, tx.id))
|
res = client.get("{}?transaction_id={}".format(BLOCKS_ENDPOINT, tx.id))
|
||||||
expected_response = [block.height]
|
expected_height = block.height
|
||||||
assert res.json == expected_response
|
assert res.json[0][2] == expected_height
|
||||||
assert res.status_code == 200
|
assert res.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user