diff --git a/python/src/trezorlib/cli/device.py b/python/src/trezorlib/cli/device.py index c09d49453..1949749f6 100644 --- a/python/src/trezorlib/cli/device.py +++ b/python/src/trezorlib/cli/device.py @@ -302,7 +302,7 @@ def unlock_bootloader(client: "TrezorClient") -> str: @cli.command() -@click.argument("enable", type=ChoiceType({"on": True, "off": False})) +@click.argument("enable", type=ChoiceType({"on": True, "off": False}), required=False) @click.option( "-e", "--expiry", @@ -329,7 +329,7 @@ def set_busy( @cli.command() -@click.argument("hex_challenge") +@click.argument("hex_challenge", required=False) @with_client def authenticate(client: "TrezorClient", hex_challenge: Optional[str]) -> None: """Get information to verify the authenticity of the device.""" diff --git a/tests/device_tests/test_msg_backup_device.py b/tests/device_tests/test_msg_backup_device.py index 7ad447af2..4e6312e81 100644 --- a/tests/device_tests/test_msg_backup_device.py +++ b/tests/device_tests/test_msg_backup_device.py @@ -31,7 +31,7 @@ from ..input_flows import ( InputFlowBip39Backup, InputFlowSlip39AdvancedBackup, InputFlowSlip39BasicBackup, - InputFlowSlip39SingleBackup, + InputFlowSlip39CustomBackup, ) @@ -115,18 +115,15 @@ def test_backup_slip39_advanced(client: Client, click_info: bool): @pytest.mark.skip_t1b1 @pytest.mark.setup_client(needs_backup=True, mnemonic=MNEMONIC_SLIP39_ADVANCED_20) @pytest.mark.parametrize( - "click_info", [True, False], ids=["click_info", "no_click_info"] + "share_threshold,share_count", [(1, 1), (2, 2), (3, 5)], ids=["1_of_1", "2_of_2", "3_of_5"] ) -def test_backup_slip39_single(client: Client, click_info: bool): - if click_info and client.model is models.T2B1: - pytest.skip("click_info not implemented on T2B1") - +def test_backup_slip39_custom(client: Client, share_threshold, share_count): assert client.features.needs_backup is True with client: - IF = InputFlowSlip39SingleBackup(client, click_info) + IF = InputFlowSlip39CustomBackup(client, share_count) client.set_input_flow(IF.get()) - device.backup(client, group_threshold=1, groups=[(1, 1)]) + device.backup(client, group_threshold=1, groups=[(share_threshold, share_count)]) client.init_device() assert client.features.initialized is True diff --git a/tests/input_flows.py b/tests/input_flows.py index 0709b59a8..be4474745 100644 --- a/tests/input_flows.py +++ b/tests/input_flows.py @@ -1383,11 +1383,11 @@ class InputFlowSlip39BasicResetRecovery(InputFlowBase): self.debug.press_yes() -class InputFlowSlip39SingleBackup(InputFlowBase): - def __init__(self, client: Client, click_info: bool): +class InputFlowSlip39CustomBackup(InputFlowBase): + def __init__(self, client: Client, share_count: int): super().__init__(client) self.mnemonics: list[str] = [] - self.click_info = click_info + self.share_count = share_count def input_flow_tt(self) -> BRGeneratorType: yield # Checklist @@ -1396,7 +1396,7 @@ class InputFlowSlip39SingleBackup(InputFlowBase): self.debug.press_yes() # Mnemonic phrases - self.mnemonics = yield from load_N_shares(self.debug, 1) + self.mnemonics = yield from load_N_shares(self.debug, self.share_count) br = yield # Confirm backup assert br.code == B.Success @@ -1409,7 +1409,7 @@ class InputFlowSlip39SingleBackup(InputFlowBase): self.debug.press_yes() # Mnemonic phrases - self.mnemonics = yield from load_N_shares(self.debug, 1) + self.mnemonics = yield from load_N_shares(self.debug, self.share_count) br = yield # Confirm backup assert br.code == B.Success @@ -1422,7 +1422,7 @@ class InputFlowSlip39SingleBackup(InputFlowBase): self.debug.press_yes() # Mnemonic phrases - self.mnemonics = yield from load_N_shares(self.debug, 1) + self.mnemonics = yield from load_N_shares(self.debug, self.share_count) br = yield # Confirm backup assert br.code == B.Success