Skip to content

Commit

Permalink
fix(tests): implement expected responses for entropy check
Browse files Browse the repository at this point in the history
fixes #4464
  • Loading branch information
matejcik committed Jan 13, 2025
1 parent a045bcb commit 940f9e6
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
63 changes: 63 additions & 0 deletions tests/device_tests/reset_recovery/test_reset_bip39_t2.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,66 @@ def test_already_initialized(client: Client):
pin_protection=True,
label="label",
)


@pytest.mark.setup_client(uninitialized=True)
def test_entropy_check(client: Client):
with client:
quicksilver = client.debug.layout_type is LayoutType.Quicksilver
client.set_expected_responses(
[
messages.ButtonRequest(name="setup_device"),
(quicksilver, messages.ButtonRequest(name="confirm_setup_device")),
messages.EntropyRequest,
messages.EntropyCheckReady,
messages.PublicKey,
messages.PublicKey,
messages.EntropyRequest,
messages.EntropyCheckReady,
messages.PublicKey,
messages.PublicKey,
messages.EntropyRequest,
messages.EntropyCheckReady,
messages.PublicKey,
messages.PublicKey,
(quicksilver, messages.ButtonRequest(name="backup_device")),
messages.Success,
messages.Features,
]
)
device.setup(
client,
strength=128,
entropy_check_count=2,
backup_type=messages.BackupType.Bip39,
skip_backup=True,
pin_protection=False,
passphrase_protection=False,
_get_entropy=MOCK_GET_ENTROPY,
)


@pytest.mark.setup_client(uninitialized=True)
def test_no_entropy_check(client: Client):
with client:
quicksilver = client.debug.layout_type is LayoutType.Quicksilver
client.set_expected_responses(
[
messages.ButtonRequest(name="setup_device"),
(quicksilver, messages.ButtonRequest(name="confirm_setup_device")),
messages.EntropyRequest,
(quicksilver, messages.ButtonRequest(name="backup_device")),
messages.Success,
messages.Features,
]
)
device.setup(
client,
strength=128,
entropy_check_count=0,
backup_type=messages.BackupType.Bip39,
skip_backup=True,
pin_protection=False,
passphrase_protection=False,
_get_entropy=MOCK_GET_ENTROPY,
)
6 changes: 6 additions & 0 deletions tests/ui_tests/fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -5054,7 +5054,9 @@
"T2T1_en_reset_recovery-test_reset_backup.py::test_skip_backup_msg[BackupType.Slip39_Advanced_Extend-8b11c1dc": "c4d39c0bb7d54c71a0a87e3ee912b5bb5ce6919693c210596cc316ab57deb48f",
"T2T1_en_reset_recovery-test_reset_backup.py::test_skip_backup_msg[BackupType.Slip39_Basic_Extendabl-cc19e908": "ff2d873c486d3f6f55bf0d6558aa759db2b42a8aa1e697a76eb3abf0b0144844",
"T2T1_en_reset_recovery-test_reset_bip39_t2.py::test_already_initialized": "8b1ccc0dbd6e6e3d02a896650ab90dd332ba4edbbcc4095e0fbb6a96e5256f75",
"T2T1_en_reset_recovery-test_reset_bip39_t2.py::test_entropy_check": "f4d850259404fdef6a340ba2245e2d1cc3e68f06ef5eea819b91b3015bc4b4f4",
"T2T1_en_reset_recovery-test_reset_bip39_t2.py::test_failed_pin": "2561ba9b866f53847e8b00bf1cf2eb29946fd1df66e96686b327ea63b067aa71",
"T2T1_en_reset_recovery-test_reset_bip39_t2.py::test_no_entropy_check": "f4d850259404fdef6a340ba2245e2d1cc3e68f06ef5eea819b91b3015bc4b4f4",
"T2T1_en_reset_recovery-test_reset_bip39_t2.py::test_reset_device": "18d8e092e8d8bc6bca6f9d3d2059a62dae0770b52a7789f10f63bf36d0317370",
"T2T1_en_reset_recovery-test_reset_bip39_t2.py::test_reset_device_192": "db10ae4b9e2db5d77080b8066d7dc6e2b79b900cc7865fde52d21dbb01813a78",
"T2T1_en_reset_recovery-test_reset_bip39_t2.py::test_reset_device_pin": "07302f85240003a3c88e8f6ba500f0e6c4b179b1592fd04a130b4e41663607af",
Expand Down Expand Up @@ -13829,7 +13831,9 @@
"T3B1_en_reset_recovery-test_reset_backup.py::test_skip_backup_msg[BackupType.Slip39_Advanced_Extend-8b11c1dc": "2bdf9c4e5985471c7ca846075f0c6401cf7e8e193c104dc20135f129cb82517b",
"T3B1_en_reset_recovery-test_reset_backup.py::test_skip_backup_msg[BackupType.Slip39_Basic_Extendabl-cc19e908": "339fe910eaa0ec50d7856339dcdfff13c7f5bf3cec24b2a3de7c5310cbecc6df",
"T3B1_en_reset_recovery-test_reset_bip39_t2.py::test_already_initialized": "1477d62e338f4d7c1bfac2fc5d2fc231218da5768666c11482dc1f83229506f3",
"T3B1_en_reset_recovery-test_reset_bip39_t2.py::test_entropy_check": "a359a52df521328ed0964dfee3a8197bc0a31518129b24624e26a7bf0ad1754e",
"T3B1_en_reset_recovery-test_reset_bip39_t2.py::test_failed_pin": "ec341a977b9a38b31fa15741cd0b38956844f4dc25441c6f30fa59576301c62b",
"T3B1_en_reset_recovery-test_reset_bip39_t2.py::test_no_entropy_check": "a359a52df521328ed0964dfee3a8197bc0a31518129b24624e26a7bf0ad1754e",
"T3B1_en_reset_recovery-test_reset_bip39_t2.py::test_reset_device": "c759377e9c5181979b3f111de2f4498b002a743fa714f63f1059ff33cf7a94e8",
"T3B1_en_reset_recovery-test_reset_bip39_t2.py::test_reset_device_192": "af5d234a3e234325074e99e2c7d3a36672d7c29af140783dc2329c016f16fe8b",
"T3B1_en_reset_recovery-test_reset_bip39_t2.py::test_reset_device_pin": "ebc2178d5cf193cb1c33369224e836e29bb557646f6ce25f4fe902233d0fa5e5",
Expand Down Expand Up @@ -22443,7 +22447,9 @@
"T3T1_en_reset_recovery-test_reset_backup.py::test_skip_backup_msg[BackupType.Slip39_Advanced_Extend-8b11c1dc": "405244c6f883533179159214fbbe64ad1d3a9c86c82860bedfcebf2a307f205a",
"T3T1_en_reset_recovery-test_reset_backup.py::test_skip_backup_msg[BackupType.Slip39_Basic_Extendabl-cc19e908": "73d98479c5672f58960dc0848b7f41fd5eabb52ab34c552c1882175a7db3a864",
"T3T1_en_reset_recovery-test_reset_bip39_t2.py::test_already_initialized": "3c5fb7d6110128ed52024a6b92654210b7acad6fe08b568d5238bfceb257a524",
"T3T1_en_reset_recovery-test_reset_bip39_t2.py::test_entropy_check": "02072595edb96be5a6a5472ab8abaa6768120aef28342c2dc078d4824b511877",
"T3T1_en_reset_recovery-test_reset_bip39_t2.py::test_failed_pin": "738b2375bb340b017517800af4db5c4240056ca1965712846da2ef61ca803780",
"T3T1_en_reset_recovery-test_reset_bip39_t2.py::test_no_entropy_check": "02072595edb96be5a6a5472ab8abaa6768120aef28342c2dc078d4824b511877",
"T3T1_en_reset_recovery-test_reset_bip39_t2.py::test_reset_device": "5d648df9d2cd53810bdacfb192fa52b728734b02d6908e42e9a724f9db05c459",
"T3T1_en_reset_recovery-test_reset_bip39_t2.py::test_reset_device_192": "61fdfd287602289777af97acf680b15fc0e70cc817ec66cb9a7e9640e321f614",
"T3T1_en_reset_recovery-test_reset_bip39_t2.py::test_reset_device_pin": "6295b1fb0f61c8bb16a233feb641d0489e7f7a115243ab9b0c616b68c8d88d1c",
Expand Down

0 comments on commit 940f9e6

Please sign in to comment.