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 10, 2025
1 parent fbd8004 commit 6450448
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 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 @@ -38,6 +38,21 @@ def reset_device(client: Client, strength: int):
IF = InputFlowBip39ResetBackup(client)
client.set_input_flow(IF.get())

client.set_expected_responses(
[
messages.ButtonRequest(name="setup_device"),
messages.EntropyRequest,
messages.ButtonRequest(name="backup_device"),
messages.ButtonRequest(name="backup_device"),
messages.ButtonRequest(name="backup_intro"),
messages.ButtonRequest(name="backup_warning"),
messages.ButtonRequest(name="share_words"),
messages.ButtonRequest(name="success_backup"),
messages.Success,
messages.Features,
]
)

# No PIN, no passphrase, don't display random
device.setup(
client,
Expand Down Expand Up @@ -249,3 +264,37 @@ 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:
client.set_expected_responses(
[
messages.ButtonRequest(name="setup_device"),
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,
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,
_get_entropy=MOCK_GET_ENTROPY,
)

0 comments on commit 6450448

Please sign in to comment.