diff --git a/python/trezorlib/tests/device_tests/conftest.py b/python/trezorlib/tests/device_tests/conftest.py index 1c1d81743..f4f8f5e2f 100644 --- a/python/trezorlib/tests/device_tests/conftest.py +++ b/python/trezorlib/tests/device_tests/conftest.py @@ -21,7 +21,8 @@ import pytest from trezorlib import debuglink, log from trezorlib.debuglink import TrezorClientDebugLink -from trezorlib.device import wipe as wipe_device +from trezorlib.device import apply_settings, wipe as wipe_device +from trezorlib.messages.PassphraseSourceType import HOST as PASSPHRASE_ON_HOST from trezorlib.transport import enumerate_devices, get_transport TREZOR_VERSION = None @@ -83,7 +84,9 @@ def setup_client(mnemonic=None, pin="", passphrase=False): label="test", language="english", ) - return function(client, *args, **kwargs) + if TREZOR_VERSION > 1 and passphrase: + apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST) + return function(*args, client=client, **kwargs) return wrapper diff --git a/python/trezorlib/tests/device_tests/test_msg_cardano_get_address_shamir.py b/python/trezorlib/tests/device_tests/test_msg_cardano_get_address_shamir.py index 657b3ada4..c2077fe18 100644 --- a/python/trezorlib/tests/device_tests/test_msg_cardano_get_address_shamir.py +++ b/python/trezorlib/tests/device_tests/test_msg_cardano_get_address_shamir.py @@ -16,9 +16,7 @@ import pytest -from trezorlib import device from trezorlib.cardano import get_address -from trezorlib.messages.PassphraseSourceType import HOST as PASSPHRASE_ON_HOST from trezorlib.tools import parse_path from .conftest import setup_client @@ -53,7 +51,6 @@ SLIP39_MNEMONIC = [ def test_cardano_get_address(client, path, expected_address): # enter passphrase assert client.debug.read_passphrase_protection() is True - device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST) client.set_passphrase("TREZOR") address = get_address(client, parse_path(path)) diff --git a/python/trezorlib/tests/device_tests/test_msg_cardano_get_public_key_shamir.py b/python/trezorlib/tests/device_tests/test_msg_cardano_get_public_key_shamir.py index 572ad1673..3e20305d2 100644 --- a/python/trezorlib/tests/device_tests/test_msg_cardano_get_public_key_shamir.py +++ b/python/trezorlib/tests/device_tests/test_msg_cardano_get_public_key_shamir.py @@ -16,9 +16,7 @@ import pytest -from trezorlib import device from trezorlib.cardano import get_public_key -from trezorlib.messages.PassphraseSourceType import HOST as PASSPHRASE_ON_HOST from trezorlib.tools import parse_path from .conftest import setup_client @@ -59,7 +57,6 @@ SLIP39_MNEMONIC = [ def test_cardano_get_public_key(client, path, public_key, chain_code): # enter passphrase assert client.debug.read_passphrase_protection() is True - device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST) client.set_passphrase("TREZOR") key = get_public_key(client, parse_path(path)) diff --git a/python/trezorlib/tests/device_tests/test_msg_cardano_sign_tx_shamir.py b/python/trezorlib/tests/device_tests/test_msg_cardano_sign_tx_shamir.py index 9d6b29f13..6651a697c 100644 --- a/python/trezorlib/tests/device_tests/test_msg_cardano_sign_tx_shamir.py +++ b/python/trezorlib/tests/device_tests/test_msg_cardano_sign_tx_shamir.py @@ -16,8 +16,7 @@ import pytest -from trezorlib import cardano, device, messages -from trezorlib.messages.PassphraseSourceType import HOST as PASSPHRASE_ON_HOST +from trezorlib import cardano, messages from .conftest import setup_client @@ -139,7 +138,6 @@ def test_cardano_sign_tx( ] def input_flow(): - client.set_passphrase("TREZOR") yield client.debug.swipe_down() client.debug.press_yes() @@ -147,7 +145,7 @@ def test_cardano_sign_tx( client.debug.swipe_down() client.debug.press_yes() - device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST) + client.set_passphrase("TREZOR") with client: client.set_expected_responses(expected_responses) client.set_input_flow(input_flow)