From 7fef64e7cf67490f5e0e97cd9aa62b8edd325c74 Mon Sep 17 00:00:00 2001 From: Marko Bencun Date: Wed, 24 Apr 2024 14:28:22 +0200 Subject: [PATCH] test/test_device: do not enforce a password According to the type in `HardwareWalletClient`, password is optional and can be `None`: ``` def __init__(self, path: str, password: Optional[str], expert: bool, chain: Chain = Chain.MAIN) -> None: ``` The test code also expects that it can be `None`, e.g.: https://github.com/bitcoin-core/HWI/blob/d774d65255e1e78ea4d97846c2b4d26a23febcfb/test/test_device.py#L140 The BitBox02 client in fact checks that it must be `None` and raises a `BadArgumentError` otherwise, as the BitBox02 does not accept any password/passphrase from the host: https://github.com/bitcoin-core/HWI/blob/d774d65255e1e78ea4d97846c2b4d26a23febcfb/hwilib/devices/bitbox02.py#L266 Other devices like the Jade also don't take a host password/passphrase, and simply ignore the param. We could also do this for the BitBox02 (not raise any error if a password is supplied), but the right solution is to not enforce a password in the tests. This commit is in preparation of adding a BitBox02 simulator with tests. --- test/test_device.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_device.py b/test/test_device.py index d87fc6017..eb7fe501c 100644 --- a/test/test_device.py +++ b/test/test_device.py @@ -41,7 +41,8 @@ def start(self): assert self.path is not None assert self.fingerprint is not None assert self.master_xpub is not None - assert self.password is not None + # No need to check that self.password is not None, as it can be None if the device does not + # accept a password/passphrase from the host. assert self.supports_ms_display is not None assert self.supports_xpub_ms_display is not None assert self.supports_unsorted_ms is not None