mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-25 15:58:08 +00:00
tests: use modified protobuf classes correctly
This commit is contained in:
parent
73a28e12f2
commit
d475248ef1
@ -21,8 +21,8 @@ from trezorlib.tools import parse_path
|
|||||||
|
|
||||||
EXPECTED_RESPONSES_NOPIN = [
|
EXPECTED_RESPONSES_NOPIN = [
|
||||||
messages.ButtonRequest(),
|
messages.ButtonRequest(),
|
||||||
messages.Success(),
|
messages.Success,
|
||||||
messages.Features(),
|
messages.Features,
|
||||||
]
|
]
|
||||||
EXPECTED_RESPONSES_PIN_T1 = [messages.PinMatrixRequest()] + EXPECTED_RESPONSES_NOPIN
|
EXPECTED_RESPONSES_PIN_T1 = [messages.PinMatrixRequest()] + EXPECTED_RESPONSES_NOPIN
|
||||||
EXPECTED_RESPONSES_PIN_TT = [messages.ButtonRequest()] + EXPECTED_RESPONSES_NOPIN
|
EXPECTED_RESPONSES_PIN_TT = [messages.ButtonRequest()] + EXPECTED_RESPONSES_NOPIN
|
||||||
|
@ -56,8 +56,8 @@ def test_backup_bip39(client):
|
|||||||
messages.ButtonRequest(code=B.ResetDevice),
|
messages.ButtonRequest(code=B.ResetDevice),
|
||||||
messages.ButtonRequest(code=B.Success),
|
messages.ButtonRequest(code=B.Success),
|
||||||
messages.ButtonRequest(code=B.Success),
|
messages.ButtonRequest(code=B.Success),
|
||||||
messages.Success(),
|
messages.Success,
|
||||||
messages.Features(),
|
messages.Features,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
device.backup(client)
|
device.backup(client)
|
||||||
@ -119,8 +119,8 @@ def test_backup_slip39_basic(client):
|
|||||||
messages.ButtonRequest(code=B.ResetDevice),
|
messages.ButtonRequest(code=B.ResetDevice),
|
||||||
messages.ButtonRequest(code=B.Success),
|
messages.ButtonRequest(code=B.Success),
|
||||||
messages.ButtonRequest(code=B.Success),
|
messages.ButtonRequest(code=B.Success),
|
||||||
messages.Success(),
|
messages.Success,
|
||||||
messages.Features(),
|
messages.Features,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
device.backup(client)
|
device.backup(client)
|
||||||
@ -239,8 +239,8 @@ def test_backup_slip39_advanced(client):
|
|||||||
messages.ButtonRequest(code=B.ResetDevice),
|
messages.ButtonRequest(code=B.ResetDevice),
|
||||||
messages.ButtonRequest(code=B.Success), # show seeds ends here
|
messages.ButtonRequest(code=B.Success), # show seeds ends here
|
||||||
messages.ButtonRequest(code=B.Success),
|
messages.ButtonRequest(code=B.Success),
|
||||||
messages.Success(),
|
messages.Success,
|
||||||
messages.Features(),
|
messages.Features,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
device.backup(client)
|
device.backup(client)
|
||||||
|
@ -48,7 +48,7 @@ def _set_wipe_code(client, pin, wipe_code):
|
|||||||
client.set_expected_responses(
|
client.set_expected_responses(
|
||||||
[messages.ButtonRequest()]
|
[messages.ButtonRequest()]
|
||||||
+ pin_matrices
|
+ pin_matrices
|
||||||
+ [messages.Success(), messages.Features()]
|
+ [messages.Success, messages.Features]
|
||||||
)
|
)
|
||||||
device.change_wipe_code(client)
|
device.change_wipe_code(client)
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ def test_set_remove_wipe_code(client):
|
|||||||
|
|
||||||
with client:
|
with client:
|
||||||
client.set_expected_responses(
|
client.set_expected_responses(
|
||||||
[messages.ButtonRequest()] * 5 + [messages.Success(), messages.Features()]
|
[messages.ButtonRequest()] * 5 + [messages.Success, messages.Features]
|
||||||
)
|
)
|
||||||
client.use_pin_sequence([PIN4, WIPE_CODE4, WIPE_CODE4])
|
client.use_pin_sequence([PIN4, WIPE_CODE4, WIPE_CODE4])
|
||||||
device.change_wipe_code(client)
|
device.change_wipe_code(client)
|
||||||
@ -71,7 +71,7 @@ def test_set_remove_wipe_code(client):
|
|||||||
# Test change wipe code.
|
# Test change wipe code.
|
||||||
with client:
|
with client:
|
||||||
client.set_expected_responses(
|
client.set_expected_responses(
|
||||||
[messages.ButtonRequest()] * 5 + [messages.Success(), messages.Features()]
|
[messages.ButtonRequest()] * 5 + [messages.Success, messages.Features]
|
||||||
)
|
)
|
||||||
client.use_pin_sequence([PIN4, WIPE_CODE6, WIPE_CODE6])
|
client.use_pin_sequence([PIN4, WIPE_CODE6, WIPE_CODE6])
|
||||||
device.change_wipe_code(client)
|
device.change_wipe_code(client)
|
||||||
@ -83,7 +83,7 @@ def test_set_remove_wipe_code(client):
|
|||||||
# Test remove wipe code.
|
# Test remove wipe code.
|
||||||
with client:
|
with client:
|
||||||
client.set_expected_responses(
|
client.set_expected_responses(
|
||||||
[messages.ButtonRequest()] * 3 + [messages.Success(), messages.Features()]
|
[messages.ButtonRequest()] * 3 + [messages.Success, messages.Features]
|
||||||
)
|
)
|
||||||
client.use_pin_sequence([PIN4])
|
client.use_pin_sequence([PIN4])
|
||||||
device.change_wipe_code(client, remove=True)
|
device.change_wipe_code(client, remove=True)
|
||||||
@ -125,7 +125,7 @@ def test_set_wipe_code_to_pin(client):
|
|||||||
|
|
||||||
with client:
|
with client:
|
||||||
client.set_expected_responses(
|
client.set_expected_responses(
|
||||||
[messages.ButtonRequest()] * 6 + [messages.Success(), messages.Features()]
|
[messages.ButtonRequest()] * 6 + [messages.Success, messages.Features]
|
||||||
)
|
)
|
||||||
client.use_pin_sequence([PIN4, PIN4, WIPE_CODE4, WIPE_CODE4])
|
client.use_pin_sequence([PIN4, PIN4, WIPE_CODE4, WIPE_CODE4])
|
||||||
device.change_wipe_code(client)
|
device.change_wipe_code(client)
|
||||||
@ -139,7 +139,7 @@ def test_set_pin_to_wipe_code(client):
|
|||||||
# Set wipe code.
|
# Set wipe code.
|
||||||
with client:
|
with client:
|
||||||
client.set_expected_responses(
|
client.set_expected_responses(
|
||||||
[messages.ButtonRequest()] * 4 + [messages.Success(), messages.Features()]
|
[messages.ButtonRequest()] * 4 + [messages.Success, messages.Features]
|
||||||
)
|
)
|
||||||
client.use_pin_sequence([WIPE_CODE4, WIPE_CODE4])
|
client.use_pin_sequence([WIPE_CODE4, WIPE_CODE4])
|
||||||
device.change_wipe_code(client)
|
device.change_wipe_code(client)
|
||||||
|
@ -194,7 +194,7 @@ class TestMsgNEMSignTxMosaics:
|
|||||||
proto.ButtonRequest(code=B.ConfirmOutput),
|
proto.ButtonRequest(code=B.ConfirmOutput),
|
||||||
proto.ButtonRequest(code=B.ConfirmOutput),
|
proto.ButtonRequest(code=B.ConfirmOutput),
|
||||||
proto.ButtonRequest(code=B.SignTx),
|
proto.ButtonRequest(code=B.SignTx),
|
||||||
proto.NEMSignedTx(),
|
proto.NEMSignedTx,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
client.set_input_flow(input_flow)
|
client.set_input_flow(input_flow)
|
||||||
|
@ -37,7 +37,7 @@ class TestMsgNEMSignTx:
|
|||||||
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
|
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
|
||||||
# Confirm recipient
|
# Confirm recipient
|
||||||
proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
|
proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
|
||||||
proto.NEMSignedTx(),
|
proto.NEMSignedTx,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ class TestMsgNEMSignTx:
|
|||||||
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
|
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
|
||||||
# Confirm recipient
|
# Confirm recipient
|
||||||
proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
|
proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
|
||||||
proto.NEMSignedTx(),
|
proto.NEMSignedTx,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ from trezorlib import messages
|
|||||||
|
|
||||||
def test_ping(client):
|
def test_ping(client):
|
||||||
with client:
|
with client:
|
||||||
client.set_expected_responses([messages.Success()])
|
client.set_expected_responses([messages.Success])
|
||||||
res = client.ping("random data")
|
res = client.ping("random data")
|
||||||
assert res == "random data"
|
assert res == "random data"
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ def test_ping(client):
|
|||||||
client.set_expected_responses(
|
client.set_expected_responses(
|
||||||
[
|
[
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.ProtectCall),
|
messages.ButtonRequest(code=messages.ButtonRequestType.ProtectCall),
|
||||||
messages.Success(),
|
messages.Success,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
res = client.ping("random data", button_protection=True)
|
res = client.ping("random data", button_protection=True)
|
||||||
|
@ -71,8 +71,8 @@ def reset_device(client, strength):
|
|||||||
proto.ButtonRequest(code=B.ResetDevice),
|
proto.ButtonRequest(code=B.ResetDevice),
|
||||||
proto.ButtonRequest(code=B.Success),
|
proto.ButtonRequest(code=B.Success),
|
||||||
proto.ButtonRequest(code=B.Success),
|
proto.ButtonRequest(code=B.Success),
|
||||||
proto.Success(),
|
proto.Success,
|
||||||
proto.Features(),
|
proto.Features,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
client.set_input_flow(input_flow)
|
client.set_input_flow(input_flow)
|
||||||
@ -184,8 +184,8 @@ class TestMsgResetDeviceT2:
|
|||||||
proto.ButtonRequest(code=B.ResetDevice),
|
proto.ButtonRequest(code=B.ResetDevice),
|
||||||
proto.ButtonRequest(code=B.Success),
|
proto.ButtonRequest(code=B.Success),
|
||||||
proto.ButtonRequest(code=B.Success),
|
proto.ButtonRequest(code=B.Success),
|
||||||
proto.Success(),
|
proto.Success,
|
||||||
proto.Features(),
|
proto.Features,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
client.set_input_flow(input_flow)
|
client.set_input_flow(input_flow)
|
||||||
|
@ -145,8 +145,8 @@ class TestMsgResetDeviceT2:
|
|||||||
proto.ButtonRequest(code=B.ResetDevice),
|
proto.ButtonRequest(code=B.ResetDevice),
|
||||||
proto.ButtonRequest(code=B.Success), # show seeds ends here
|
proto.ButtonRequest(code=B.Success), # show seeds ends here
|
||||||
proto.ButtonRequest(code=B.Success),
|
proto.ButtonRequest(code=B.Success),
|
||||||
proto.Success(),
|
proto.Success,
|
||||||
proto.Features(),
|
proto.Features,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
client.set_input_flow(input_flow)
|
client.set_input_flow(input_flow)
|
||||||
|
@ -92,8 +92,8 @@ def reset_device(client, strength):
|
|||||||
proto.ButtonRequest(code=B.ResetDevice),
|
proto.ButtonRequest(code=B.ResetDevice),
|
||||||
proto.ButtonRequest(code=B.Success),
|
proto.ButtonRequest(code=B.Success),
|
||||||
proto.ButtonRequest(code=B.Success),
|
proto.ButtonRequest(code=B.Success),
|
||||||
proto.Success(),
|
proto.Success,
|
||||||
proto.Features(),
|
proto.Features,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
client.set_input_flow(input_flow)
|
client.set_input_flow(input_flow)
|
||||||
|
@ -57,8 +57,8 @@ def backup_flow_bip39(client):
|
|||||||
messages.ButtonRequest(code=B.ResetDevice),
|
messages.ButtonRequest(code=B.ResetDevice),
|
||||||
messages.ButtonRequest(code=B.Success),
|
messages.ButtonRequest(code=B.Success),
|
||||||
messages.ButtonRequest(code=B.Success),
|
messages.ButtonRequest(code=B.Success),
|
||||||
messages.Success(),
|
messages.Success,
|
||||||
messages.Features(),
|
messages.Features,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
client.set_input_flow(input_flow)
|
client.set_input_flow(input_flow)
|
||||||
@ -102,8 +102,8 @@ def backup_flow_slip39_basic(client):
|
|||||||
* 5 # individual shares
|
* 5 # individual shares
|
||||||
+ [
|
+ [
|
||||||
messages.ButtonRequest(code=B.Success),
|
messages.ButtonRequest(code=B.Success),
|
||||||
messages.Success(),
|
messages.Success,
|
||||||
messages.Features(),
|
messages.Features,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
device.backup(client)
|
device.backup(client)
|
||||||
@ -163,8 +163,8 @@ def backup_flow_slip39_advanced(client):
|
|||||||
* 25 # individual shares
|
* 25 # individual shares
|
||||||
+ [
|
+ [
|
||||||
messages.ButtonRequest(code=B.Success),
|
messages.ButtonRequest(code=B.Success),
|
||||||
messages.Success(),
|
messages.Success,
|
||||||
messages.Features(),
|
messages.Features,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
device.backup(client)
|
device.backup(client)
|
||||||
@ -240,8 +240,8 @@ def test_skip_backup_manual(client, backup_type, backup_flow):
|
|||||||
messages.EntropyRequest(),
|
messages.EntropyRequest(),
|
||||||
messages.ButtonRequest(code=B.ResetDevice),
|
messages.ButtonRequest(code=B.ResetDevice),
|
||||||
messages.ButtonRequest(code=B.ResetDevice),
|
messages.ButtonRequest(code=B.ResetDevice),
|
||||||
messages.Success(),
|
messages.Success,
|
||||||
messages.Features(),
|
messages.Features,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
device.reset(
|
device.reset(
|
||||||
|
@ -75,8 +75,8 @@ def reset(client, strength=128, skip_backup=False):
|
|||||||
messages.ButtonRequest(code=B.ResetDevice),
|
messages.ButtonRequest(code=B.ResetDevice),
|
||||||
messages.ButtonRequest(code=B.Success),
|
messages.ButtonRequest(code=B.Success),
|
||||||
messages.ButtonRequest(code=B.Success),
|
messages.ButtonRequest(code=B.Success),
|
||||||
messages.Success(),
|
messages.Success,
|
||||||
messages.Features(),
|
messages.Features,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
client.set_input_flow(input_flow)
|
client.set_input_flow(input_flow)
|
||||||
@ -136,8 +136,8 @@ def recover(client, mnemonic):
|
|||||||
messages.ButtonRequest(code=B.RecoveryHomepage),
|
messages.ButtonRequest(code=B.RecoveryHomepage),
|
||||||
messages.ButtonRequest(code=B.MnemonicInput),
|
messages.ButtonRequest(code=B.MnemonicInput),
|
||||||
messages.ButtonRequest(code=B.Success),
|
messages.ButtonRequest(code=B.Success),
|
||||||
messages.Success(),
|
messages.Success,
|
||||||
messages.Features(),
|
messages.Features,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
ret = device.recover(client, pin_protection=False, label="label")
|
ret = device.recover(client, pin_protection=False, label="label")
|
||||||
|
@ -170,8 +170,8 @@ def reset(client, strength=128):
|
|||||||
messages.ButtonRequest(code=B.ResetDevice),
|
messages.ButtonRequest(code=B.ResetDevice),
|
||||||
messages.ButtonRequest(code=B.Success), # show seeds ends here
|
messages.ButtonRequest(code=B.Success), # show seeds ends here
|
||||||
messages.ButtonRequest(code=B.Success),
|
messages.ButtonRequest(code=B.Success),
|
||||||
messages.Success(),
|
messages.Success,
|
||||||
messages.Features(),
|
messages.Features,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
client.set_input_flow(input_flow)
|
client.set_input_flow(input_flow)
|
||||||
|
@ -102,8 +102,8 @@ def reset(client, strength=128):
|
|||||||
messages.ButtonRequest(code=B.ResetDevice),
|
messages.ButtonRequest(code=B.ResetDevice),
|
||||||
messages.ButtonRequest(code=B.Success),
|
messages.ButtonRequest(code=B.Success),
|
||||||
messages.ButtonRequest(code=B.Success),
|
messages.ButtonRequest(code=B.Success),
|
||||||
messages.Success(),
|
messages.Success,
|
||||||
messages.Features(),
|
messages.Features,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
client.set_input_flow(input_flow)
|
client.set_input_flow(input_flow)
|
||||||
|
@ -40,7 +40,7 @@ def setup_device_core(client, pin, wipe_code):
|
|||||||
|
|
||||||
with client:
|
with client:
|
||||||
client.set_expected_responses(
|
client.set_expected_responses(
|
||||||
[messages.ButtonRequest()] * 5 + [messages.Success(), messages.Features()]
|
[messages.ButtonRequest()] * 5 + [messages.Success, messages.Features]
|
||||||
)
|
)
|
||||||
client.set_input_flow(input_flow)
|
client.set_input_flow(input_flow)
|
||||||
device.change_wipe_code(client)
|
device.change_wipe_code(client)
|
||||||
|
Loading…
Reference in New Issue
Block a user