1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-17 21:22:10 +00:00
trezor-firmware/tests/device_tests/signtx.py
matejcik feaaaf8973 tests: simplify code of test_msg_signtx
Instead of a function generating the expected_responses, introduce
shortcuts (request_input, request_output...) so that the static
expected_responses are more readable.
2020-04-25 18:27:29 +02:00

37 lines
918 B
Python

from trezorlib import messages
T = messages.RequestType
def request_input(n, tx_hash=None):
return messages.TxRequest(
request_type=T.TXINPUT,
details=messages.TxRequestDetailsType(request_index=n, tx_hash=tx_hash),
)
def request_output(n, tx_hash=None):
return messages.TxRequest(
request_type=T.TXOUTPUT,
details=messages.TxRequestDetailsType(request_index=n, tx_hash=tx_hash),
)
def request_meta(tx_hash):
return messages.TxRequest(
request_type=T.TXMETA, details=messages.TxRequestDetailsType(tx_hash=tx_hash),
)
def request_finished():
return messages.TxRequest(request_type=T.TXFINISHED)
def request_extra_data(ofs, len, tx_hash):
return messages.TxRequest(
request_type=T.TXEXTRADATA,
details=messages.TxRequestDetailsType(
tx_hash=tx_hash, extra_data_offset=ofs, extra_data_len=len
),
)