diff --git a/tests/device_tests/test_msg_clearsession.py b/tests/device_tests/test_msg_clearsession.py index 6b8ed1e215..e19ce317c3 100644 --- a/tests/device_tests/test_msg_clearsession.py +++ b/tests/device_tests/test_msg_clearsession.py @@ -16,65 +16,41 @@ import pytest -from trezorlib import messages as proto +from trezorlib import messages from trezorlib.btc import get_public_node from trezorlib.tools import parse_path +ADDRESS_N = parse_path("44'/0'/0'") +XPUB = "xpub6BiVtCpG9fQPxnPmHXG8PhtzQdWC2Su4qWu6XW9tpWFYhxydCLJGrWBJZ5H6qTAHdPQ7pQhtpjiYZVZARo14qHiay2fvrX996oEP42u8wZy" + @pytest.mark.skip_ui @pytest.mark.setup_client(pin=True, passphrase=True) def test_clear_session(client): if client.features.model == "1": - init_responses = [ - proto.PinMatrixRequest(), - proto.PassphraseRequest(), - ] + init_responses = [messages.PinMatrixRequest(), messages.PassphraseRequest()] else: - init_responses = [ - proto.PassphraseRequest(), - ] - cached_responses = [ - proto.ButtonRequest(code=proto.ButtonRequestType.PublicKey), - proto.PublicKey(), - ] + init_responses = [messages.PassphraseRequest()] + + cached_responses = [messages.PublicKey()] with client: client.set_expected_responses(init_responses + cached_responses) - assert ( - get_public_node( - client, parse_path("44'/0'/0'"), show_display=True - ).node.public_key.hex() - == "03c8166eb40ac84088b618ec07c7cebadacee31c5f5b04a1e8c2a2f3e748eb2cdd" - ) + assert get_public_node(client, ADDRESS_N).xpub == XPUB with client: # pin and passphrase are cached client.set_expected_responses(cached_responses) - assert ( - get_public_node( - client, parse_path("44'/0'/0'"), show_display=True - ).node.public_key.hex() - == "03c8166eb40ac84088b618ec07c7cebadacee31c5f5b04a1e8c2a2f3e748eb2cdd" - ) + assert get_public_node(client, ADDRESS_N).xpub == XPUB client.clear_session() # session cache is cleared with client: client.set_expected_responses(init_responses + cached_responses) - assert ( - get_public_node( - client, parse_path("44'/0'/0'"), show_display=True - ).node.public_key.hex() - == "03c8166eb40ac84088b618ec07c7cebadacee31c5f5b04a1e8c2a2f3e748eb2cdd" - ) + assert get_public_node(client, ADDRESS_N).xpub == XPUB with client: # pin and passphrase are cached client.set_expected_responses(cached_responses) - assert ( - get_public_node( - client, parse_path("44'/0'/0'"), show_display=True - ).node.public_key.hex() - == "03c8166eb40ac84088b618ec07c7cebadacee31c5f5b04a1e8c2a2f3e748eb2cdd" - ) + assert get_public_node(client, ADDRESS_N).xpub == XPUB