mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-23 16:38:46 +00:00
tests/device: assert exception type and message
This commit is contained in:
parent
03b3ef10f4
commit
aec8f04f68
@ -233,5 +233,10 @@ class TestMsgSigntxSegwit(TrezorTest):
|
|||||||
proto.TxRequest(request_type=proto.RequestType.TXINPUT, details=proto.TxRequestDetailsType(request_index=0)),
|
proto.TxRequest(request_type=proto.RequestType.TXINPUT, details=proto.TxRequestDetailsType(request_index=0)),
|
||||||
proto.Failure(code=proto.FailureType.ProcessError),
|
proto.Failure(code=proto.FailureType.ProcessError),
|
||||||
])
|
])
|
||||||
with pytest.raises(CallException):
|
try:
|
||||||
self.client.sign_tx('Testnet', [inp1], [out1, out2], debug_processor=attack_processor)
|
self.client.sign_tx('Testnet', [inp1], [out1, out2], debug_processor=attack_processor)
|
||||||
|
except CallException as exc:
|
||||||
|
assert exc.args[0] == proto.FailureType.ProcessError
|
||||||
|
assert exc.args[1] == 'Transaction has changed during signing'
|
||||||
|
else:
|
||||||
|
assert False # exception expected
|
||||||
|
@ -249,7 +249,10 @@ class TestMultisig(TrezorTest):
|
|||||||
script_type=proto.OutputScriptType.PAYTOADDRESS
|
script_type=proto.OutputScriptType.PAYTOADDRESS
|
||||||
)
|
)
|
||||||
|
|
||||||
with self.client:
|
try:
|
||||||
# It should throw Failure 'Pubkey not found in multisig script'
|
|
||||||
with pytest.raises(CallException):
|
|
||||||
self.client.sign_tx('Bitcoin', [inp1, ], [out1, ])
|
self.client.sign_tx('Bitcoin', [inp1, ], [out1, ])
|
||||||
|
except CallException as exc:
|
||||||
|
assert exc.args[0] == proto.FailureType.DataError
|
||||||
|
assert exc.args[1] == 'Pubkey not found in multisig script'
|
||||||
|
else:
|
||||||
|
assert False # exception expected
|
||||||
|
@ -88,12 +88,6 @@ class TestOpReturn(TrezorTest):
|
|||||||
prev_index=0,
|
prev_index=0,
|
||||||
)
|
)
|
||||||
|
|
||||||
out1 = proto.TxOutputType(
|
|
||||||
address='1MJ2tj2ThBE62zXbBYA5ZaN3fdve5CPAz1',
|
|
||||||
amount=390000 - 10000 - 10000,
|
|
||||||
script_type=proto.OutputScriptType.PAYTOADDRESS,
|
|
||||||
)
|
|
||||||
|
|
||||||
out1 = proto.TxOutputType(
|
out1 = proto.TxOutputType(
|
||||||
op_return_data=b'test of the op_return data',
|
op_return_data=b'test of the op_return data',
|
||||||
amount=10000,
|
amount=10000,
|
||||||
@ -110,5 +104,11 @@ class TestOpReturn(TrezorTest):
|
|||||||
proto.TxRequest(request_type=proto.RequestType.TXOUTPUT, details=proto.TxRequestDetailsType(request_index=0)),
|
proto.TxRequest(request_type=proto.RequestType.TXOUTPUT, details=proto.TxRequestDetailsType(request_index=0)),
|
||||||
proto.Failure()
|
proto.Failure()
|
||||||
])
|
])
|
||||||
with pytest.raises(CallException):
|
|
||||||
self.client.sign_tx('Bitcoin', [inp1, ], [out1, ])
|
try:
|
||||||
|
self.client.sign_tx('Bitcoin', [inp1], [out1])
|
||||||
|
except CallException as exc:
|
||||||
|
assert exc.args[0] == proto.FailureType.DataError
|
||||||
|
assert exc.args[1] == 'OP_RETURN output with non-zero amount'
|
||||||
|
else:
|
||||||
|
assert False # exception expected
|
||||||
|
Loading…
Reference in New Issue
Block a user