Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test/test_device: do not enforce a password #735

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

benma
Copy link
Contributor

@benma benma commented Apr 24, 2024

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.:

if self.emulator.password is not None:

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:

raise BadArgumentError(

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.

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.
@benma
Copy link
Contributor Author

benma commented May 15, 2024

@achow101 please check and merge. Or is there anyone else I should tag instead? I am not sure who is in the list of maintainers of this repo. Thanks.

@achow101
Copy link
Member

ACK 7fef64e

@achow101 achow101 merged commit 9fbe6be into bitcoin-core:master Jun 24, 2024
9 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants