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