mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 22:38:08 +00:00
fix(tests): unlock device when getting a new session
[no changelog]
This commit is contained in:
parent
f4a9b3d9c3
commit
8c05e2ef7f
@ -64,7 +64,7 @@ class TrezorClient:
|
||||
_management_session: Session | None = None
|
||||
_features: messages.Features | None = None
|
||||
_protocol_version: int
|
||||
_has_setup_pin: bool = False # Should by used only by conftest
|
||||
_setup_pin: str | None = None # Should by used only by conftest
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -392,8 +392,7 @@ def client(
|
||||
needs_backup=setup_params["needs_backup"], # type: ignore
|
||||
no_backup=setup_params["no_backup"], # type: ignore
|
||||
)
|
||||
if setup_params["pin"] is not None:
|
||||
_raw_client._has_setup_pin = True
|
||||
_raw_client._setup_pin = setup_params["pin"]
|
||||
|
||||
if request.node.get_closest_marker("experimental"):
|
||||
apply_settings(session, experimental_features=True)
|
||||
@ -419,12 +418,14 @@ def session(
|
||||
else:
|
||||
derive_cardano = bool(request.node.get_closest_marker("cardano"))
|
||||
passphrase = client.passphrase or ""
|
||||
if client._setup_pin is not None:
|
||||
client.use_pin_sequence([client._setup_pin])
|
||||
session = client.get_session(
|
||||
derive_cardano=derive_cardano, passphrase=passphrase
|
||||
)
|
||||
try:
|
||||
wrapped_session = SessionDebugWrapper(session)
|
||||
if client._has_setup_pin:
|
||||
if client._setup_pin is not None:
|
||||
wrapped_session.lock()
|
||||
yield wrapped_session
|
||||
finally:
|
||||
|
Loading…
Reference in New Issue
Block a user