1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-04-20 09:09:02 +00:00

fix(pytest): fix message filters in SessionDebugWrapper

This commit is contained in:
M1nd3r 2025-04-15 13:40:54 +02:00
parent ef7a536647
commit c02e34e3d9

View File

@ -995,10 +995,15 @@ class SessionDebugWrapper(Session):
return self.client
def _write(self, msg: t.Any) -> None:
if isinstance(self.client, TrezorClientDebugLink):
msg = self.client._filter_message(msg)
self._session._write(msg)
def _read(self) -> t.Any:
return self._session._read()
msg = self._session._read()
if isinstance(self.client, TrezorClientDebugLink):
msg = self.client._filter_message(msg)
return msg
def resume(self) -> None:
self._session.resume()
@ -1037,6 +1042,10 @@ class TrezorClientDebugLink(TrezorClient):
protocol: ProtocolV1Channel | ProtocolV2Channel
actual_responses: list[protobuf.MessageType] | None = None
filters: t.Dict[
t.Type[protobuf.MessageType],
t.Callable[[protobuf.MessageType], protobuf.MessageType] | None,
] = {}
def __init__(
self,