diff --git a/docs/developers/hello_world_feature_TT.md b/docs/developers/hello_world_feature_TT.md index 1f52972b2..e4908b608 100644 --- a/docs/developers/hello_world_feature_TT.md +++ b/docs/developers/hello_world_feature_TT.md @@ -308,7 +308,7 @@ VECTORS = ( # name, amount, show_display ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.parametrize("name, amount, show_display", VECTORS) def test_hello_world( client: Client, name: str, amount: Optional[int], show_display: bool @@ -325,7 +325,7 @@ def test_hello_world( Unlike in unit tests, [pytest](https://docs.pytest.org) is used as the test framework, which is more suitable for bigger and more complex test suites. -As the functionality is developed only for `TT`, to not break the `CI`, we want to skip this test's execution for model `T1`, by adding `@pytest.mark.skip_t1` decorator. +As the functionality is developed only for `TT`, to not break the `CI`, we want to skip this test's execution for model `T1`, by adding `@pytest.mark.skip_t1b1` decorator. We are also using the `@pytest.mark.parametrize` decorator, which is an efficient way of testing multiple inputs into the same test case. diff --git a/docs/tests/device-tests.md b/docs/tests/device-tests.md index f3ba110bc..50d608108 100644 --- a/docs/tests/device-tests.md +++ b/docs/tests/device-tests.md @@ -106,11 +106,11 @@ the following marker: This marker must be registered in `REGISTERED_MARKERS` file in `tests` folder. Tests can be run only for specific models - it is done by disallowing the tests for the other models. -`@pytest.mark.skip_t1` -`@pytest.mark.skip_t2` -`@pytest.mark.skip_tr` +`@pytest.mark.skip_t1b1` +`@pytest.mark.skip_t2t1` +`@pytest.mark.skip_t2b1` `@pytest.mark.skip_t3t1` -are valid markers to skip current test for T1, TT and TR respectively. +are valid markers to skip current test for Model 1, Model T, Safe 3, and T3T1 respectively. [pytest-random-order]: https://pypi.org/project/pytest-random-order/ diff --git a/tests/click_tests/test_passphrase_tr.py b/tests/click_tests/test_passphrase_tr.py index d7fe39ac4..5b850f879 100644 --- a/tests/click_tests/test_passphrase_tr.py +++ b/tests/click_tests/test_passphrase_tr.py @@ -36,7 +36,7 @@ if TYPE_CHECKING: from ..device_handler import BackgroundDeviceHandler -pytestmark = [pytest.mark.skip_t1, pytest.mark.skip_t2, pytest.mark.skip_t3t1] +pytestmark = [pytest.mark.skip_t1b1, pytest.mark.skip_t2t1, pytest.mark.skip_t3t1] # Testing the maximum length is really 50 # TODO: show some UI message when length reaches 50? diff --git a/tests/click_tests/test_passphrase_tt.py b/tests/click_tests/test_passphrase_tt.py index 8ec3c1cee..f0d3ad248 100644 --- a/tests/click_tests/test_passphrase_tt.py +++ b/tests/click_tests/test_passphrase_tt.py @@ -30,7 +30,7 @@ if TYPE_CHECKING: from ..device_handler import BackgroundDeviceHandler -pytestmark = [pytest.mark.skip_t1, pytest.mark.skip_tr] +pytestmark = [pytest.mark.skip_t1b1, pytest.mark.skip_t2b1] # TODO: it is not possible to cancel the passphrase entry on TT # NOTE: the prompt (underscoring) is not there when a space is entered diff --git a/tests/click_tests/test_pin.py b/tests/click_tests/test_pin.py index 6f5c475b2..444066247 100644 --- a/tests/click_tests/test_pin.py +++ b/tests/click_tests/test_pin.py @@ -37,7 +37,7 @@ if TYPE_CHECKING: from ..device_handler import BackgroundDeviceHandler -pytestmark = pytest.mark.skip_t1 +pytestmark = pytest.mark.skip_t1b1 PIN_CANCELLED = pytest.raises(exceptions.TrezorFailure, match="PIN entry cancelled") PIN_INVALID = pytest.raises(exceptions.TrezorFailure, match="PIN invalid") @@ -285,7 +285,7 @@ def test_pin_incorrect(device_handler: "BackgroundDeviceHandler"): _input_see_confirm(debug, PIN4) -@pytest.mark.skip_tr("TODO: will we support cancelling on TR?") +@pytest.mark.skip_t2b1("TODO: will we support cancelling on T2B1?") @pytest.mark.setup_client(pin=PIN4) def test_pin_cancel(device_handler: "BackgroundDeviceHandler"): with PIN_CANCELLED, prepare(device_handler) as debug: diff --git a/tests/click_tests/test_recovery.py b/tests/click_tests/test_recovery.py index 99e8a540f..5f1643315 100644 --- a/tests/click_tests/test_recovery.py +++ b/tests/click_tests/test_recovery.py @@ -30,7 +30,7 @@ if TYPE_CHECKING: from ..device_handler import BackgroundDeviceHandler -pytestmark = [pytest.mark.skip_t1] +pytestmark = [pytest.mark.skip_t1b1] @contextmanager diff --git a/tests/click_tests/test_reset_bip39.py b/tests/click_tests/test_reset_bip39.py index 7fd349e27..9433efcc6 100644 --- a/tests/click_tests/test_reset_bip39.py +++ b/tests/click_tests/test_reset_bip39.py @@ -28,7 +28,7 @@ if TYPE_CHECKING: from ..device_handler import BackgroundDeviceHandler -pytestmark = [pytest.mark.skip_t1] +pytestmark = [pytest.mark.skip_t1b1] @pytest.mark.setup_client(uninitialized=True) diff --git a/tests/click_tests/test_reset_slip39_advanced.py b/tests/click_tests/test_reset_slip39_advanced.py index a49c58357..12500dc93 100644 --- a/tests/click_tests/test_reset_slip39_advanced.py +++ b/tests/click_tests/test_reset_slip39_advanced.py @@ -28,7 +28,7 @@ if TYPE_CHECKING: from ..device_handler import BackgroundDeviceHandler -pytestmark = [pytest.mark.skip_t1] +pytestmark = [pytest.mark.skip_t1b1] @pytest.mark.setup_client(uninitialized=True) diff --git a/tests/click_tests/test_reset_slip39_basic.py b/tests/click_tests/test_reset_slip39_basic.py index e0e3617bb..cdb7f5654 100644 --- a/tests/click_tests/test_reset_slip39_basic.py +++ b/tests/click_tests/test_reset_slip39_basic.py @@ -28,7 +28,7 @@ if TYPE_CHECKING: from ..device_handler import BackgroundDeviceHandler -pytestmark = [pytest.mark.skip_t1] +pytestmark = [pytest.mark.skip_t1b1] @pytest.mark.parametrize( diff --git a/tests/click_tests/test_tutorial.py b/tests/click_tests/test_tutorial.py index 277657c17..e7c04e6ab 100644 --- a/tests/click_tests/test_tutorial.py +++ b/tests/click_tests/test_tutorial.py @@ -31,7 +31,7 @@ if TYPE_CHECKING: # T2B1-only -pytestmark = [pytest.mark.skip_t1, pytest.mark.skip_t2, pytest.mark.skip_t3t1] +pytestmark = [pytest.mark.skip_t1b1, pytest.mark.skip_t2t1, pytest.mark.skip_t3t1] @contextmanager diff --git a/tests/common.py b/tests/common.py index 0dd3b3eb2..606100895 100644 --- a/tests/common.py +++ b/tests/common.py @@ -90,11 +90,11 @@ def parametrize_using_common_fixtures(*paths: str) -> "MarkDecorator": skip_marks = [] for skip_model in skip_models: if skip_model in ("t1", "t1b1"): - skip_marks.append(pytest.mark.skip_t1) + skip_marks.append(pytest.mark.skip_t1b1) if skip_model in ("t2", "t2t1"): - skip_marks.append(pytest.mark.skip_t2) + skip_marks.append(pytest.mark.skip_t2t1) if skip_model in ("tr", "t2b1"): - skip_marks.append(pytest.mark.skip_tr) + skip_marks.append(pytest.mark.skip_t2b1) if skip_model == "t3t1": skip_marks.append(pytest.mark.skip_t3t1) diff --git a/tests/conftest.py b/tests/conftest.py index 43d921178..a30ff3e7b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -140,7 +140,7 @@ def _raw_client(request: pytest.FixtureRequest) -> Client: # Setting the appropriate language # Not doing it for T1 - if client.features.model != "1": + if client.model is not models.T1B1: lang = request.session.config.getoption("lang") or "en" assert isinstance(lang, str) translations.set_language(client, lang) @@ -179,8 +179,8 @@ def client( Every test function that requires a client instance will get it from here. If we can't connect to a debuggable device, the test will fail. - If 'skip_t2' is used and TT is connected, the test is skipped. Vice versa with T1 - and 'skip_t1'. Same with TR. + If 'skip_t2t1' is used and TT is connected, the test is skipped. Vice versa with T1 + and 'skip_t1b1'. Same with T2B1, T3T1. The client instance is wiped and preconfigured with "all all all..." mnemonic, no password and no pin. It is possible to customize this with the `setup_client` @@ -198,15 +198,21 @@ def client( @pytest.mark.experimental """ - if request.node.get_closest_marker("skip_t2") and _raw_client.features.model == "T": + if ( + request.node.get_closest_marker("skip_t2t1") + and _raw_client.model is models.T2T1 + ): pytest.skip("Test excluded on Trezor T") - if request.node.get_closest_marker("skip_t1") and _raw_client.features.model == "1": + if ( + request.node.get_closest_marker("skip_t1b1") + and _raw_client.model is models.T1B1 + ): pytest.skip("Test excluded on Trezor 1") if ( - request.node.get_closest_marker("skip_tr") - and _raw_client.features.model == "Safe 3" + request.node.get_closest_marker("skip_t2b1") + and _raw_client.model is models.T2B1 ): - pytest.skip("Test excluded on Trezor R") + pytest.skip("Test excluded on Trezor T2B1") if ( request.node.get_closest_marker("skip_t3t1") and _raw_client.model is models.T3T1 @@ -245,7 +251,7 @@ def client( wipe_device(_raw_client) # Load language again, as it got erased in wipe - if _raw_client.features.model != "1": + if _raw_client.model is not models.T1B1: lang = request.session.config.getoption("lang") or "en" assert isinstance(lang, str) if lang != "en": @@ -392,9 +398,9 @@ def pytest_configure(config: "Config") -> None: Registers known markers, enables verbose output if requested. """ # register known markers - config.addinivalue_line("markers", "skip_t1: skip the test on Trezor One") - config.addinivalue_line("markers", "skip_t2: skip the test on Trezor T") - config.addinivalue_line("markers", "skip_tr: skip the test on Trezor R") + config.addinivalue_line("markers", "skip_t1b1: skip the test on Trezor One") + config.addinivalue_line("markers", "skip_t2t1: skip the test on Trezor T") + config.addinivalue_line("markers", "skip_t2b1: skip the test on Trezor T2B1") config.addinivalue_line("markers", "skip_t3t1: skip the test on Trezor T3T1") config.addinivalue_line( "markers", "experimental: enable experimental features on Trezor" @@ -419,7 +425,8 @@ def pytest_runtest_setup(item: pytest.Item) -> None: both T1 and TT. """ if all( - item.get_closest_marker(marker) for marker in ("skip_t1", "skip_t2", "skip_tr") + item.get_closest_marker(marker) + for marker in ("skip_t1b1", "skip_t2t1", "skip_t2b1") ): raise RuntimeError("Don't skip tests for all trezor models!") diff --git a/tests/device_tests/binance/test_get_address.py b/tests/device_tests/binance/test_get_address.py index f58336aca..5c4ecc20a 100644 --- a/tests/device_tests/binance/test_get_address.py +++ b/tests/device_tests/binance/test_get_address.py @@ -25,7 +25,7 @@ from ...input_flows import InputFlowShowAddressQRCode pytestmark = [ pytest.mark.altcoin, pytest.mark.binance, - pytest.mark.skip_t1, # T1 support is not planned + pytest.mark.skip_t1b1, # T1 support is not planned pytest.mark.setup_client( mnemonic="offer caution gift cross surge pretty orange during eye soldier popular holiday mention east eight office fashion ill parrot vault rent devote earth cousin" ), diff --git a/tests/device_tests/binance/test_get_public_key.py b/tests/device_tests/binance/test_get_public_key.py index add82eb6d..59cadd283 100644 --- a/tests/device_tests/binance/test_get_public_key.py +++ b/tests/device_tests/binance/test_get_public_key.py @@ -27,7 +27,7 @@ BINANCE_PATH = parse_path("m/44h/714h/0h/0/0") @pytest.mark.altcoin @pytest.mark.binance -@pytest.mark.skip_t1 # T1 support is not planned +@pytest.mark.skip_t1b1 # T1 support is not planned @pytest.mark.setup_client( mnemonic="offer caution gift cross surge pretty orange during eye soldier popular holiday mention east eight office fashion ill parrot vault rent devote earth cousin" ) diff --git a/tests/device_tests/binance/test_sign_tx.py b/tests/device_tests/binance/test_sign_tx.py index 05dcacc4d..bbdaf36f3 100644 --- a/tests/device_tests/binance/test_sign_tx.py +++ b/tests/device_tests/binance/test_sign_tx.py @@ -103,7 +103,7 @@ BINANCE_TEST_VECTORS = [ @pytest.mark.altcoin @pytest.mark.binance -@pytest.mark.skip_t1 # T1 support is not planned +@pytest.mark.skip_t1b1 # T1 support is not planned @pytest.mark.setup_client( mnemonic="offer caution gift cross surge pretty orange during eye soldier popular holiday mention east eight office fashion ill parrot vault rent devote earth cousin" ) diff --git a/tests/device_tests/bitcoin/test_bcash.py b/tests/device_tests/bitcoin/test_bcash.py index dde87449f..1a6c3b2ac 100644 --- a/tests/device_tests/bitcoin/test_bcash.py +++ b/tests/device_tests/bitcoin/test_bcash.py @@ -467,7 +467,7 @@ def test_send_bch_multisig_change(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_send_bch_external_presigned(client: Client): inp1 = messages.TxInputType( # address_n=parse_path("44'/145'/0'/1/0"), diff --git a/tests/device_tests/bitcoin/test_bgold.py b/tests/device_tests/bitcoin/test_bgold.py index 660fefaaa..d19c22caf 100644 --- a/tests/device_tests/bitcoin/test_bgold.py +++ b/tests/device_tests/bitcoin/test_bgold.py @@ -47,7 +47,7 @@ FAKE_TXHASH_a63dbe = bytes.fromhex( "a63dbedd8cd284bf0d3c468e84b9b0eeb14c3a08824eab8f80e7723a299f30db" ) -pytestmark = [pytest.mark.altcoin, pytest.mark.skip_tr] +pytestmark = [pytest.mark.altcoin, pytest.mark.skip_t2b1] # All data taken from T1 @@ -548,7 +548,7 @@ def test_send_mixed_inputs(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_send_btg_external_presigned(client: Client): # NOTE: fake input tx used diff --git a/tests/device_tests/bitcoin/test_dash.py b/tests/device_tests/bitcoin/test_dash.py index fe2019696..92d472c81 100644 --- a/tests/device_tests/bitcoin/test_dash.py +++ b/tests/device_tests/bitcoin/test_dash.py @@ -40,7 +40,7 @@ TXHASH_15575a = bytes.fromhex( "15575a1c874bd60a819884e116c42e6791c8283ce1fc3b79f0d18531a61bbb8a" ) -pytestmark = [pytest.mark.altcoin, pytest.mark.skip_tr] +pytestmark = [pytest.mark.altcoin, pytest.mark.skip_t2b1] def test_send_dash(client: Client): diff --git a/tests/device_tests/bitcoin/test_decred.py b/tests/device_tests/bitcoin/test_decred.py index 474cfe1f5..fe4a6ec6c 100644 --- a/tests/device_tests/bitcoin/test_decred.py +++ b/tests/device_tests/bitcoin/test_decred.py @@ -53,7 +53,7 @@ FAKE_TXHASH_51bc9c = bytes.fromhex( pytestmark = [ pytest.mark.altcoin, pytest.mark.decred, - pytest.mark.skip_tr, + pytest.mark.skip_t2b1, pytest.mark.skip_t3t1, ] @@ -105,7 +105,7 @@ def test_send_decred(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_purchase_ticket_decred(client: Client): # NOTE: fake input tx used @@ -168,7 +168,7 @@ def test_purchase_ticket_decred(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_spend_from_stake_generation_and_revocation_decred(client: Client): # NOTE: fake input tx used diff --git a/tests/device_tests/bitcoin/test_descriptors.py b/tests/device_tests/bitcoin/test_descriptors.py index 2d0a21a63..23695a420 100644 --- a/tests/device_tests/bitcoin/test_descriptors.py +++ b/tests/device_tests/bitcoin/test_descriptors.py @@ -161,7 +161,7 @@ def _address_n(purpose, coin, account, script_type): return res -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.parametrize( "coin, account, purpose, script_type, descriptors", VECTORS_DESCRIPTORS ) diff --git a/tests/device_tests/bitcoin/test_getaddress.py b/tests/device_tests/bitcoin/test_getaddress.py index 54d3bea20..4191e7e8f 100644 --- a/tests/device_tests/bitcoin/test_getaddress.py +++ b/tests/device_tests/bitcoin/test_getaddress.py @@ -136,7 +136,7 @@ def test_elements(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_address_mac(client: Client): resp = btc.get_authenticated_address( client, "Bitcoin", parse_path("m/44h/0h/0h/1/0") @@ -163,7 +163,7 @@ def test_address_mac(client: Client): assert resp.mac is None -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.altcoin def test_altcoin_address_mac(client: Client): resp = btc.get_authenticated_address( diff --git a/tests/device_tests/bitcoin/test_getaddress_show.py b/tests/device_tests/bitcoin/test_getaddress_show.py index 7734641ed..83d82d8ad 100644 --- a/tests/device_tests/bitcoin/test_getaddress_show.py +++ b/tests/device_tests/bitcoin/test_getaddress_show.py @@ -50,8 +50,8 @@ VECTORS = ( # path, script_type, address ) -@pytest.mark.skip_t2 -@pytest.mark.skip_tr +@pytest.mark.skip_t2t1 +@pytest.mark.skip_t2b1 @pytest.mark.skip_t3t1 @pytest.mark.parametrize("path, script_type, address", VECTORS) def test_show_t1( @@ -78,7 +78,7 @@ def test_show_t1( ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.parametrize("chunkify", (True, False)) @pytest.mark.parametrize("path, script_type, address", VECTORS) def test_show_tt( @@ -104,7 +104,7 @@ def test_show_tt( ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.parametrize("path, script_type, address", VECTORS) def test_show_cancel( client: Client, path: str, script_type: messages.InputScriptType, address: str @@ -231,7 +231,7 @@ VECTORS_MULTISIG = ( # script_type, bip48_type, address, xpubs, ignore_xpub_mag ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.multisig @pytest.mark.parametrize( "script_type, bip48_type, address, xpubs, ignore_xpub_magic", VECTORS_MULTISIG diff --git a/tests/device_tests/bitcoin/test_getpublickey.py b/tests/device_tests/bitcoin/test_getpublickey.py index 199a20615..c6d7eb0a9 100644 --- a/tests/device_tests/bitcoin/test_getpublickey.py +++ b/tests/device_tests/bitcoin/test_getpublickey.py @@ -116,7 +116,7 @@ def test_get_public_node(client: Client, coin_name, xpub_magic, path, xpub): assert bip32.serialize(res.node, xpub_magic) == xpub -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.parametrize("coin_name, xpub_magic, path, xpub", VECTORS_BITCOIN) def test_get_public_node_show(client: Client, coin_name, xpub_magic, path, xpub): with client: diff --git a/tests/device_tests/bitcoin/test_multisig.py b/tests/device_tests/bitcoin/test_multisig.py index 5ccf10da5..303bedf87 100644 --- a/tests/device_tests/bitcoin/test_multisig.py +++ b/tests/device_tests/bitcoin/test_multisig.py @@ -16,7 +16,7 @@ import pytest -from trezorlib import btc, messages +from trezorlib import btc, messages, models from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.exceptions import TrezorFailure from trezorlib.tools import parse_path @@ -238,7 +238,7 @@ def test_missing_pubkey(client: Client): with pytest.raises(TrezorFailure) as exc: btc.sign_tx(client, "Bitcoin", [inp1], [out1], prev_txes=TX_API) - if client.features.model == "1": + if client.model is models.T1B1: assert exc.value.message.endswith("Failed to derive scriptPubKey") else: assert exc.value.message.endswith("Pubkey not found in multisig script") diff --git a/tests/device_tests/bitcoin/test_signmessage.py b/tests/device_tests/bitcoin/test_signmessage.py index eec62bb51..90f2fde4a 100644 --- a/tests/device_tests/bitcoin/test_signmessage.py +++ b/tests/device_tests/bitcoin/test_signmessage.py @@ -18,7 +18,7 @@ from typing import Any import pytest -from trezorlib import btc, messages +from trezorlib import btc, messages, models from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.debuglink import message_filters from trezorlib.exceptions import Cancelled @@ -33,16 +33,16 @@ def case( id: str, *args: Any, altcoin: bool = False, - skip_t1: bool = False, - skip_tr: bool = False + skip_t1b1: bool = False, + skip_t2b1: bool = False ): marks = [] if altcoin: marks.append(pytest.mark.altcoin) - if skip_t1: - marks.append(pytest.mark.skip_t1) - if skip_tr: - marks.append(pytest.mark.skip_tr) + if skip_t1b1: + marks.append(pytest.mark.skip_t1b1) + if skip_t2b1: + marks.append(pytest.mark.skip_t2b1) return pytest.param(*args, id=id, marks=marks) @@ -174,7 +174,7 @@ VECTORS = ( # case name, coin_name, path, script_type, address, message, signat "1FoHjQT6bAEu2FQGzTgqj4PBneoiCAk4ZN", b"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "1f40ae58dd68480a2f39eecf4decfe79ceacde3f865502db67c083b8465b33535c0750d5377b7ac62e534f71c922cd029f659761f8ac99e859df36322c5b320eff", - skip_t1=True, + skip_t1b1=True, ), # ==== Testnet script types ==== case( @@ -262,7 +262,7 @@ VECTORS = ( # case name, coin_name, path, script_type, address, message, signat "This is an example of a signed message.", "206b1f8ba47ef9eaf87aa900e41ab1e97f67e8c09292faa4acf825228d074c4b774484046dcb1d9bbf0603045dbfb328c3e1b0c09c5ae133e89e604a67a1fc6cca", altcoin=True, - skip_tr=True, + skip_t2b1=True, ), case( "decred-empty", @@ -274,7 +274,7 @@ VECTORS = ( # case name, coin_name, path, script_type, address, message, signat "", "1fd2d57490b44a0361c7809768cad032d41ba1d4b7a297f935fc65ae05f71de7ea0c6c6fd265cc5154f1fa4acd7006b6a00ddd67fb7333c1594aff9120b3ba8024", altcoin=True, - skip_tr=True, + skip_t2b1=True, ), ) @@ -304,8 +304,8 @@ def test_signmessage( assert sig.signature.hex() == signature -@pytest.mark.skip_t1 -@pytest.mark.skip_tr +@pytest.mark.skip_t1b1 +@pytest.mark.skip_t2b1 @pytest.mark.parametrize( "coin_name, path, script_type, no_script_type, address, message, signature", VECTORS ) @@ -348,7 +348,7 @@ MESSAGE_LENGTHS = ( ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.parametrize("message", MESSAGE_LENGTHS) def test_signmessage_pagination(client: Client, message: str): with client: @@ -362,15 +362,15 @@ def test_signmessage_pagination(client: Client, message: str): ) # We cannot differentiate between a newline and space in the message read from Trezor. - # TODO: do the check also for model R + # TODO: do the check also for T2B1 if client.model in (models.T2T1, models.T3T1): message_read = IF.message_read.replace(" ", "").replace("...", "") signed_message = message.replace("\n", "").replace(" ", "") assert signed_message in message_read -@pytest.mark.skip_t1 -@pytest.mark.skip_tr(reason="Different screen size") +@pytest.mark.skip_t1b1 +@pytest.mark.skip_t2b1(reason="Different screen size") def test_signmessage_pagination_trailing_newline(client: Client): message = "THIS\nMUST\nNOT\nBE\nPAGINATED\n" # The trailing newline must not cause a new paginated screen to appear. diff --git a/tests/device_tests/bitcoin/test_signtx.py b/tests/device_tests/bitcoin/test_signtx.py index 4ed5934fb..68001b2e3 100644 --- a/tests/device_tests/bitcoin/test_signtx.py +++ b/tests/device_tests/bitcoin/test_signtx.py @@ -641,7 +641,7 @@ def test_fee_high_warning(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_fee_high_hardfail(client: Client): # input tx: 25fee583181847cbe9d9fd9a483a8b8626c99854a72d01de848ef40508d0f3bc # (The "25fee" tx hash is very suitable for testing high fees) @@ -1445,7 +1445,7 @@ def test_lock_time(client: Client, lock_time: int, sequence: int): ) -@pytest.mark.skip_t1(reason="Cannot test layouts on T1") +@pytest.mark.skip_t1b1(reason="Cannot test layouts on T1") def test_lock_time_blockheight(client: Client): # input tx: 0dac366fd8a67b2a89fbb0d31086e7acded7a5bbf9ef9daa935bc873229ef5b5 @@ -1477,7 +1477,7 @@ def test_lock_time_blockheight(client: Client): ) -@pytest.mark.skip_t1(reason="Cannot test layouts on T1") +@pytest.mark.skip_t1b1(reason="Cannot test layouts on T1") @pytest.mark.parametrize( "lock_time_str", ("1985-11-05 00:53:20", "2048-08-16 22:14:00") ) @@ -1516,7 +1516,7 @@ def test_lock_time_datetime(client: Client, lock_time_str: str): ) -@pytest.mark.skip_t1(reason="Cannot test layouts on T1") +@pytest.mark.skip_t1b1(reason="Cannot test layouts on T1") def test_information(client: Client): # input tx: 0dac366fd8a67b2a89fbb0d31086e7acded7a5bbf9ef9daa935bc873229ef5b5 @@ -1547,7 +1547,7 @@ def test_information(client: Client): ) -@pytest.mark.skip_t1(reason="Cannot test layouts on T1") +@pytest.mark.skip_t1b1(reason="Cannot test layouts on T1") def test_information_mixed(client: Client): inp1 = messages.TxInputType( address_n=parse_path("m/44h/1h/0h/0/0"), # mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q @@ -1582,7 +1582,7 @@ def test_information_mixed(client: Client): ) -@pytest.mark.skip_t1(reason="Cannot test layouts on T1") +@pytest.mark.skip_t1b1(reason="Cannot test layouts on T1") def test_information_cancel(client: Client): # input tx: 0dac366fd8a67b2a89fbb0d31086e7acded7a5bbf9ef9daa935bc873229ef5b5 @@ -1613,7 +1613,7 @@ def test_information_cancel(client: Client): ) -@pytest.mark.skip_t1(reason="Cannot test layouts on T1") +@pytest.mark.skip_t1b1(reason="Cannot test layouts on T1") def test_information_replacement(client: Client): # Use the change output and an external output to bump the fee. # Originally fee was 3780, now 108060 (94280 from change and 10000 from external). diff --git a/tests/device_tests/bitcoin/test_signtx_external.py b/tests/device_tests/bitcoin/test_signtx_external.py index 8bd657a28..9474fd1bb 100644 --- a/tests/device_tests/bitcoin/test_signtx_external.py +++ b/tests/device_tests/bitcoin/test_signtx_external.py @@ -16,7 +16,7 @@ import pytest -from trezorlib import btc, device, messages +from trezorlib import btc, device, messages, models from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.exceptions import TrezorFailure from trezorlib.messages import SafetyCheckLevel @@ -81,7 +81,7 @@ TXHASH_1010b2 = bytes.fromhex( ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_p2pkh_presigned(client: Client): inp1 = messages.TxInputType( # mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q @@ -178,7 +178,7 @@ def test_p2pkh_presigned(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_p2wpkh_in_p2sh_presigned(client: Client): inp1 = messages.TxInputType( # 2N1LGaGg836mqSQqiuUBLfcyGBhyZbremDX @@ -301,7 +301,7 @@ def test_p2wpkh_in_p2sh_presigned(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_p2wpkh_presigned(client: Client): inp1 = messages.TxInputType( # tb1qkvwu9g3k2pdxewfqr7syz89r3gj557l3uuf9r9 @@ -366,7 +366,7 @@ def test_p2wpkh_presigned(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_p2wsh_external_presigned(client: Client): inp1 = messages.TxInputType( address_n=parse_path("m/84h/1h/0h/0/0"), @@ -474,7 +474,7 @@ def test_p2wsh_external_presigned(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_p2tr_external_presigned(client: Client): inp1 = messages.TxInputType( # tb1p8tvmvsvhsee73rhym86wt435qrqm92psfsyhy6a3n5gw455znnpqm8wald @@ -566,13 +566,13 @@ def test_p2tr_external_presigned(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_p2pkh_with_proof(client: Client): # TODO pass -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_p2wpkh_in_p2sh_with_proof(client: Client): # TODO pass @@ -611,7 +611,7 @@ def test_p2wpkh_with_proof(client: Client): ) with client: - is_t1 = client.features.model == "1" + is_t1 = client.model is models.T1B1 client.set_expected_responses( [ request_input(0), @@ -704,7 +704,7 @@ def test_p2tr_with_proof(client: Client): ) with client: - is_t1 = client.features.model == "1" + is_t1 = client.model is models.T1B1 client.set_expected_responses( [ request_input(0), diff --git a/tests/device_tests/bitcoin/test_signtx_payreq.py b/tests/device_tests/bitcoin/test_signtx_payreq.py index 7ab410f6b..a1142defc 100644 --- a/tests/device_tests/bitcoin/test_signtx_payreq.py +++ b/tests/device_tests/bitcoin/test_signtx_payreq.py @@ -18,7 +18,7 @@ from collections import namedtuple import pytest -from trezorlib import btc, messages, misc +from trezorlib import btc, messages, misc, models from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.exceptions import TrezorFailure from trezorlib.tools import parse_path @@ -33,15 +33,15 @@ PREV_HASH, PREV_TX = forge_prevtx([(INPUT_ADDRESS, 12_300_000)], network="testne PREV_TXES = {PREV_HASH: PREV_TX} -pytestmark = [pytest.mark.skip_t1, pytest.mark.experimental] +pytestmark = [pytest.mark.skip_t1b1, pytest.mark.experimental] -def case(id, *args, altcoin: bool = False, skip_tr: bool = False): +def case(id, *args, altcoin: bool = False, skip_t2b1: bool = False): marks = [] if altcoin: marks.append(pytest.mark.altcoin) - if skip_tr: - marks.append(pytest.mark.skip_tr) + if skip_t2b1: + marks.append(pytest.mark.skip_t2b1) return pytest.param(*args, id=id, marks=marks) @@ -114,13 +114,13 @@ SERIALIZED_TX = "01000000000101e29305e85821ea86f2bca1fcfe45e7cb0c8de87b612479ee6 "out0", (PaymentRequestParams([0], memos1, get_nonce=True),), altcoin=True, - skip_tr=True, + skip_t2b1=True, ), case( "out1", (PaymentRequestParams([1], memos2, get_nonce=True),), altcoin=True, - skip_tr=True, + skip_t2b1=True, ), case("out2", (PaymentRequestParams([2], [], get_nonce=True),)), case( @@ -184,8 +184,8 @@ def test_payment_request(client: Client, payment_request_params): def test_payment_request_details(client: Client): - if client.features.model == "Safe 3": - pytest.skip("Details not implemented on TR") + if client.model is models.T2B1: + pytest.skip("Details not implemented on T2B1") # Test that payment request details are shown when requested. outputs[0].payment_req_index = 0 @@ -275,7 +275,7 @@ def test_payment_req_wrong_mac_refund(client: Client): @pytest.mark.altcoin -@pytest.mark.skip_tr +@pytest.mark.skip_t2b1 def test_payment_req_wrong_mac_purchase(client: Client): # Test wrong MAC in payment request memo. memo = CoinPurchaseMemo( diff --git a/tests/device_tests/bitcoin/test_signtx_prevhash.py b/tests/device_tests/bitcoin/test_signtx_prevhash.py index 3f7e1693d..09a5be83e 100644 --- a/tests/device_tests/bitcoin/test_signtx_prevhash.py +++ b/tests/device_tests/bitcoin/test_signtx_prevhash.py @@ -4,7 +4,7 @@ from io import BytesIO import pytest -from trezorlib import btc, messages, tools +from trezorlib import btc, messages, models, tools from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.exceptions import TrezorFailure @@ -62,9 +62,9 @@ def hash_tx(data: bytes) -> bytes: return sha256(sha256(data).digest()).digest()[::-1] -def _check_error_message(value: bytes, model: str, message: str): +def _check_error_message(value: bytes, model: models.TrezorModel, message: str): # T1 has several possible errors - if model == "1" and len(value) > 32: + if model is models.T1B1 and len(value) > 32: assert message.endswith("bytes overflow") else: assert message.endswith("Provided prev_hash is invalid.") @@ -92,7 +92,7 @@ def test_invalid_prev_hash(client: Client, prev_hash): with pytest.raises(TrezorFailure) as e: btc.sign_tx(client, "Testnet", [inp1], [out1], prev_txes={}) - _check_error_message(prev_hash, client.features.model, e.value.message) + _check_error_message(prev_hash, client.model, e.value.message) @with_bad_prevhashes @@ -134,7 +134,7 @@ def test_invalid_prev_hash_attack(client: Client, prev_hash): # check that injection was performed assert counter == 0 - _check_error_message(prev_hash, client.features.model, e.value.message) + _check_error_message(prev_hash, client.model, e.value.message) @with_bad_prevhashes @@ -165,4 +165,4 @@ def test_invalid_prev_hash_in_prevtx(client: Client, prev_hash): with pytest.raises(TrezorFailure) as e: btc.sign_tx(client, "Bitcoin", [inp0], [out1], prev_txes={tx_hash: prev_tx}) - _check_error_message(prev_hash, client.features.model, e.value.message) + _check_error_message(prev_hash, client.model, e.value.message) diff --git a/tests/device_tests/bitcoin/test_signtx_replacement.py b/tests/device_tests/bitcoin/test_signtx_replacement.py index 4e9cea962..d15409799 100644 --- a/tests/device_tests/bitcoin/test_signtx_replacement.py +++ b/tests/device_tests/bitcoin/test_signtx_replacement.py @@ -354,7 +354,7 @@ def test_p2wpkh_finalize(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.parametrize( "out1_amount, out2_amount, copayer_witness, fee_confirm, expected_tx", ( @@ -648,7 +648,7 @@ def test_p2wpkh_in_p2sh_fee_bump_from_external(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_tx_meld(client: Client): # Meld two original transactions into one, joining the change-outputs into a different one. @@ -869,7 +869,7 @@ def test_attack_steal_change(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_attack_false_internal(client: Client): # Falsely claim that an external input is internal in the original transaction. # If this were possible, it would allow an attacker to make it look like the @@ -976,7 +976,7 @@ def test_attack_fake_int_input_amount(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_attack_fake_ext_input_amount(client: Client): # Give a fake input amount for an original external input while giving the correct # amount for the replacement input. If an attacker could decrease the amount of an diff --git a/tests/device_tests/bitcoin/test_signtx_segwit.py b/tests/device_tests/bitcoin/test_signtx_segwit.py index 967ecfe51..763626cae 100644 --- a/tests/device_tests/bitcoin/test_signtx_segwit.py +++ b/tests/device_tests/bitcoin/test_signtx_segwit.py @@ -16,7 +16,7 @@ import pytest -from trezorlib import btc, messages +from trezorlib import btc, messages, models from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.exceptions import TrezorFailure from trezorlib.tools import H_, parse_path @@ -417,7 +417,7 @@ def test_attack_mixed_inputs(client: Client): request_finished(), ] - if client.features.model == "1": + if client.model is models.T1B1: # T1 asks for first input for witness again expected_responses.insert(-2, request_input(0)) @@ -436,7 +436,7 @@ def test_attack_mixed_inputs(client: Client): # In Phase 1 make the user confirm a lower value of the segwit input. inp2.amount = FAKE_AMOUNT - if client.features.model == "1": + if client.model is models.T1B1: # T1 fails as soon as it encounters the fake amount. expected_responses = ( expected_responses[:4] + expected_responses[5:15] + [messages.Failure()] diff --git a/tests/device_tests/bitcoin/test_signtx_taproot.py b/tests/device_tests/bitcoin/test_signtx_taproot.py index b7300f429..f548154ae 100644 --- a/tests/device_tests/bitcoin/test_signtx_taproot.py +++ b/tests/device_tests/bitcoin/test_signtx_taproot.py @@ -16,7 +16,7 @@ import pytest -from trezorlib import btc, messages +from trezorlib import btc, messages, models from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.exceptions import TrezorFailure from trezorlib.tools import H_, parse_path @@ -293,7 +293,7 @@ def test_send_mixed(client: Client): request_input(0), request_input(1), request_input(2), - (client.features.model == "1", request_input(3)), + (client.model is models.T1B1, request_input(3)), request_finished(), ] ) diff --git a/tests/device_tests/bitcoin/test_zcash.py b/tests/device_tests/bitcoin/test_zcash.py index caf7b7725..65c376be1 100644 --- a/tests/device_tests/bitcoin/test_zcash.py +++ b/tests/device_tests/bitcoin/test_zcash.py @@ -228,7 +228,7 @@ def test_spend_old_versions(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_external_presigned(client: Client): inp1 = messages.TxInputType( # tmQoJ3PTXgQLaRRZZYT6xk8XtjRbr2kCqwu diff --git a/tests/device_tests/cardano/test_address_public_key.py b/tests/device_tests/cardano/test_address_public_key.py index 6da8d0c29..725e20877 100644 --- a/tests/device_tests/cardano/test_address_public_key.py +++ b/tests/device_tests/cardano/test_address_public_key.py @@ -32,7 +32,7 @@ from ...input_flows import InputFlowShowXpubQRCode pytestmark = [ pytest.mark.altcoin, pytest.mark.cardano, - pytest.mark.skip_t1, + pytest.mark.skip_t1b1, ] diff --git a/tests/device_tests/cardano/test_derivations.py b/tests/device_tests/cardano/test_derivations.py index 923956ae9..6c7bfe2b8 100644 --- a/tests/device_tests/cardano/test_derivations.py +++ b/tests/device_tests/cardano/test_derivations.py @@ -27,7 +27,7 @@ from ...common import MNEMONIC_SLIP39_BASIC_20_3of6 pytestmark = [ pytest.mark.altcoin, pytest.mark.cardano, - pytest.mark.skip_t1, + pytest.mark.skip_t1b1, ] ADDRESS_N = parse_path("m/1852h/1815h/0h") diff --git a/tests/device_tests/cardano/test_get_native_script_hash.py b/tests/device_tests/cardano/test_get_native_script_hash.py index 11edb8e6c..27ffee2ac 100644 --- a/tests/device_tests/cardano/test_get_native_script_hash.py +++ b/tests/device_tests/cardano/test_get_native_script_hash.py @@ -25,7 +25,7 @@ from ...common import parametrize_using_common_fixtures pytestmark = [ pytest.mark.altcoin, pytest.mark.cardano, - pytest.mark.skip_t1, + pytest.mark.skip_t1b1, ] diff --git a/tests/device_tests/cardano/test_sign_tx.py b/tests/device_tests/cardano/test_sign_tx.py index 12668727a..4d72d0fc7 100644 --- a/tests/device_tests/cardano/test_sign_tx.py +++ b/tests/device_tests/cardano/test_sign_tx.py @@ -25,14 +25,14 @@ from ...common import parametrize_using_common_fixtures pytestmark = [ pytest.mark.altcoin, pytest.mark.cardano, - pytest.mark.skip_t1, + pytest.mark.skip_t1b1, ] def show_details_input_flow(client: Client): yield client.debug.wait_layout() - # Clicking for model T, pressing right for model R + # Touch screen click vs pressing right for T2B1 if client.model in (models.T2T1, models.T3T1): SHOW_ALL_BUTTON_POSITION = (143, 167) client.debug.click(SHOW_ALL_BUTTON_POSITION) diff --git a/tests/device_tests/eos/test_get_public_key.py b/tests/device_tests/eos/test_get_public_key.py index ef5a66786..c5a304af1 100644 --- a/tests/device_tests/eos/test_get_public_key.py +++ b/tests/device_tests/eos/test_get_public_key.py @@ -26,8 +26,8 @@ from ...input_flows import InputFlowShowXpubQRCode @pytest.mark.altcoin @pytest.mark.eos -@pytest.mark.skip_t1 -@pytest.mark.skip_tr # coin not supported +@pytest.mark.skip_t1b1 +@pytest.mark.skip_t2b1 # coin not supported @pytest.mark.skip_t3t1 @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_eos_get_public_key(client: Client): diff --git a/tests/device_tests/eos/test_signtx.py b/tests/device_tests/eos/test_signtx.py index 036bb31c4..d43f6f51f 100644 --- a/tests/device_tests/eos/test_signtx.py +++ b/tests/device_tests/eos/test_signtx.py @@ -29,8 +29,8 @@ ADDRESS_N = parse_path("m/44h/194h/0h/0/0") pytestmark = [ pytest.mark.altcoin, pytest.mark.eos, - pytest.mark.skip_t1, - pytest.mark.skip_tr, # coin not supported + pytest.mark.skip_t1b1, + pytest.mark.skip_t2b1, # coin not supported pytest.mark.skip_t3t1, pytest.mark.setup_client(mnemonic=MNEMONIC12), ] diff --git a/tests/device_tests/ethereum/test_definitions.py b/tests/device_tests/ethereum/test_definitions.py index 6f2a0cef0..f2546a5d0 100644 --- a/tests/device_tests/ethereum/test_definitions.py +++ b/tests/device_tests/ethereum/test_definitions.py @@ -197,10 +197,10 @@ MethodType = Callable[[Client, int, "bytes | None"], None] METHODS = ( _call_getaddress, _call_signmessage, - pytest.param(_call_sign_typed_data, marks=pytest.mark.skip_t1), + pytest.param(_call_sign_typed_data, marks=pytest.mark.skip_t1b1), pytest.param( _call_sign_typed_data_hash, - marks=[pytest.mark.skip_t2, pytest.mark.skip_tr, pytest.mark.skip_t3t1], + marks=[pytest.mark.skip_t2t1, pytest.mark.skip_t2b1, pytest.mark.skip_t3t1], ), ) diff --git a/tests/device_tests/ethereum/test_getaddress.py b/tests/device_tests/ethereum/test_getaddress.py index 3d0b67837..0001681e8 100644 --- a/tests/device_tests/ethereum/test_getaddress.py +++ b/tests/device_tests/ethereum/test_getaddress.py @@ -34,7 +34,7 @@ def test_getaddress(client: Client, parameters, result): ) -@pytest.mark.skip_t1("No input flow for T1") +@pytest.mark.skip_t1b1("No input flow for T1") @parametrize_using_common_fixtures("ethereum/getaddress.json") def test_getaddress_chunkify_details(client: Client, parameters, result): with client: diff --git a/tests/device_tests/ethereum/test_getpublickey.py b/tests/device_tests/ethereum/test_getpublickey.py index 5c5af044f..3a6fe3615 100644 --- a/tests/device_tests/ethereum/test_getpublickey.py +++ b/tests/device_tests/ethereum/test_getpublickey.py @@ -44,8 +44,8 @@ def test_slip25_disallowed(client: Client): ethereum.get_public_node(client, path) -@pytest.mark.skip_t2 -@pytest.mark.skip_tr +@pytest.mark.skip_t2t1 +@pytest.mark.skip_t2b1 @pytest.mark.skip_t3t1 def test_legacy_restrictions(client: Client): path = parse_path("m/46'") diff --git a/tests/device_tests/ethereum/test_sign_typed_data.py b/tests/device_tests/ethereum/test_sign_typed_data.py index 700811273..6ce72aa72 100644 --- a/tests/device_tests/ethereum/test_sign_typed_data.py +++ b/tests/device_tests/ethereum/test_sign_typed_data.py @@ -26,7 +26,7 @@ from ...input_flows import InputFlowEIP712Cancel, InputFlowEIP712ShowMore pytestmark = [pytest.mark.altcoin, pytest.mark.ethereum] -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @parametrize_using_common_fixtures("ethereum/sign_typed_data.json") def test_ethereum_sign_typed_data(client: Client, parameters, result): with client: @@ -41,8 +41,8 @@ def test_ethereum_sign_typed_data(client: Client, parameters, result): assert f"0x{ret.signature.hex()}" == result["sig"] -@pytest.mark.skip_t2 -@pytest.mark.skip_tr +@pytest.mark.skip_t2t1 +@pytest.mark.skip_t2b1 @pytest.mark.skip_t3t1 @parametrize_using_common_fixtures("ethereum/sign_typed_data.json") def test_ethereum_sign_typed_data_blind(client: Client, parameters, result): @@ -97,7 +97,7 @@ DATA = { } -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_ethereum_sign_typed_data_show_more_button(client: Client): with client: client.watch_layout() @@ -111,7 +111,7 @@ def test_ethereum_sign_typed_data_show_more_button(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_ethereum_sign_typed_data_cancel(client: Client): with client, pytest.raises(exceptions.Cancelled): client.watch_layout() diff --git a/tests/device_tests/ethereum/test_signtx.py b/tests/device_tests/ethereum/test_signtx.py index 2e4adde17..a14d2d9a6 100644 --- a/tests/device_tests/ethereum/test_signtx.py +++ b/tests/device_tests/ethereum/test_signtx.py @@ -113,7 +113,7 @@ example_input_data = { } -@pytest.mark.skip_t1("T1 does not support input flows") +@pytest.mark.skip_t1b1("T1 does not support input flows") def test_signtx_fee_info(client: Client): input_flow = InputFlowEthereumSignTxShowFeeInfo(client).get() _do_test_signtx( @@ -124,7 +124,7 @@ def test_signtx_fee_info(client: Client): ) -@pytest.mark.skip_t1("T1 does not support input flows") +@pytest.mark.skip_t1b1("T1 does not support input flows") def test_signtx_go_back_from_summary(client: Client): input_flow = InputFlowEthereumSignTxGoBackFromSummary(client).get() _do_test_signtx( @@ -430,7 +430,7 @@ HEXDATA = "0123456789abcd000023456789abcd010003456789abcd020000456789abcd0300000 @pytest.mark.parametrize( "flow", (input_flow_data_skip, input_flow_data_scroll_down, input_flow_data_go_back) ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_signtx_data_pagination(client: Client, flow): def _sign_tx_call(): ethereum.sign_tx( @@ -457,7 +457,7 @@ def test_signtx_data_pagination(client: Client, flow): _sign_tx_call() -@pytest.mark.skip_t1("T1 does not support Everstake") +@pytest.mark.skip_t1b1("T1 does not support Everstake") @parametrize_using_common_fixtures("ethereum/sign_tx_staking.json") @pytest.mark.parametrize("chunkify", (True, False)) def test_signtx_staking(client: Client, chunkify: bool, parameters: dict, result: dict): @@ -467,7 +467,7 @@ def test_signtx_staking(client: Client, chunkify: bool, parameters: dict, result ) -@pytest.mark.skip_t1("T1 does not support Everstake") +@pytest.mark.skip_t1b1("T1 does not support Everstake") @parametrize_using_common_fixtures("ethereum/sign_tx_staking_data_error.json") def test_signtx_staking_bad_inputs(client: Client, parameters: dict, result: dict): # result not needed @@ -488,7 +488,7 @@ def test_signtx_staking_bad_inputs(client: Client, parameters: dict, result: dic ) -@pytest.mark.skip_t1("T1 does not support Everstake") +@pytest.mark.skip_t1b1("T1 does not support Everstake") @parametrize_using_common_fixtures("ethereum/sign_tx_staking_eip1559.json") def test_signtx_staking_eip1559(client: Client, parameters: dict, result: dict): with client: diff --git a/tests/device_tests/misc/test_cosi.py b/tests/device_tests/misc/test_cosi.py index e92f24e39..8a54ced7c 100644 --- a/tests/device_tests/misc/test_cosi.py +++ b/tests/device_tests/misc/test_cosi.py @@ -109,7 +109,7 @@ def test_cosi_sign3(client: Client): cosi.verify_combined(signature, DIGEST, global_pk) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_cosi_different_key(client: Client): with pytest.raises(TrezorFailure): commit = cosi.commit(client, parse_path("m/10018h/0h")) @@ -135,7 +135,7 @@ def test_cosi_different_key(client: Client): (b"T2B1", 3), ), ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_slip26_paths(client: Client, model: bytes, image_type: int): slip26_model = int.from_bytes(model, "little") path = Address([H_(10026), H_(slip26_model), H_(image_type), H_(0)]) diff --git a/tests/device_tests/monero/test_getaddress.py b/tests/device_tests/monero/test_getaddress.py index 4c0808fc3..f48f9e812 100644 --- a/tests/device_tests/monero/test_getaddress.py +++ b/tests/device_tests/monero/test_getaddress.py @@ -41,7 +41,7 @@ TEST_VECTORS = [ pytestmark = [ pytest.mark.altcoin, pytest.mark.monero, - pytest.mark.skip_t1, + pytest.mark.skip_t1b1, pytest.mark.setup_client(mnemonic=MNEMONIC12), ] diff --git a/tests/device_tests/monero/test_getwatchkey.py b/tests/device_tests/monero/test_getwatchkey.py index 8b183cc8c..743e615ba 100644 --- a/tests/device_tests/monero/test_getwatchkey.py +++ b/tests/device_tests/monero/test_getwatchkey.py @@ -25,7 +25,7 @@ from ...common import MNEMONIC12 @pytest.mark.altcoin @pytest.mark.monero -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_monero_getwatchkey(client: Client): res = monero.get_watch_key(client, parse_path("m/44h/128h/0h")) diff --git a/tests/device_tests/nem/test_getaddress.py b/tests/device_tests/nem/test_getaddress.py index c478a9a38..c565ccd85 100644 --- a/tests/device_tests/nem/test_getaddress.py +++ b/tests/device_tests/nem/test_getaddress.py @@ -25,7 +25,7 @@ from ...common import MNEMONIC12 @pytest.mark.altcoin @pytest.mark.nem -@pytest.mark.skip_tr # coin not supported, +@pytest.mark.skip_t2b1 # coin not supported, @pytest.mark.skip_t3t1 @pytest.mark.setup_client(mnemonic=MNEMONIC12) @pytest.mark.parametrize("chunkify", (True, False)) diff --git a/tests/device_tests/nem/test_signtx_mosaics.py b/tests/device_tests/nem/test_signtx_mosaics.py index 0b85bbb80..1c1459bc7 100644 --- a/tests/device_tests/nem/test_signtx_mosaics.py +++ b/tests/device_tests/nem/test_signtx_mosaics.py @@ -27,7 +27,7 @@ ADDRESS_N = parse_path("m/44h/1h/0h/0h/0h") pytestmark = [ pytest.mark.altcoin, pytest.mark.nem, - pytest.mark.skip_tr, # coin not supported, + pytest.mark.skip_t2b1, # coin not supported, pytest.mark.skip_t3t1, pytest.mark.setup_client(mnemonic=MNEMONIC12), ] diff --git a/tests/device_tests/nem/test_signtx_multisig.py b/tests/device_tests/nem/test_signtx_multisig.py index c31b613fa..c9d0caa56 100644 --- a/tests/device_tests/nem/test_signtx_multisig.py +++ b/tests/device_tests/nem/test_signtx_multisig.py @@ -25,7 +25,7 @@ from ...common import MNEMONIC12 pytestmark = [ pytest.mark.altcoin, pytest.mark.nem, - pytest.mark.skip_tr, # coin not supported, + pytest.mark.skip_t2b1, # coin not supported, pytest.mark.skip_t3t1, pytest.mark.setup_client(mnemonic=MNEMONIC12), ] diff --git a/tests/device_tests/nem/test_signtx_others.py b/tests/device_tests/nem/test_signtx_others.py index 45be5e045..02a17eaf5 100644 --- a/tests/device_tests/nem/test_signtx_others.py +++ b/tests/device_tests/nem/test_signtx_others.py @@ -25,7 +25,7 @@ from ...common import MNEMONIC12 pytestmark = [ pytest.mark.altcoin, pytest.mark.nem, - pytest.mark.skip_tr, # coin not supported, + pytest.mark.skip_t2b1, # coin not supported, pytest.mark.skip_t3t1, pytest.mark.setup_client(mnemonic=MNEMONIC12), ] diff --git a/tests/device_tests/nem/test_signtx_transfers.py b/tests/device_tests/nem/test_signtx_transfers.py index b47437db0..87a77ec6a 100644 --- a/tests/device_tests/nem/test_signtx_transfers.py +++ b/tests/device_tests/nem/test_signtx_transfers.py @@ -25,7 +25,7 @@ from ...common import MNEMONIC12, is_core pytestmark = [ pytest.mark.altcoin, pytest.mark.nem, - pytest.mark.skip_tr, # coin not supported, + pytest.mark.skip_t2b1, # coin not supported, pytest.mark.skip_t3t1, pytest.mark.setup_client(mnemonic=MNEMONIC12), ] diff --git a/tests/device_tests/reset_recovery/test_recovery_bip39_dryrun.py b/tests/device_tests/reset_recovery/test_recovery_bip39_dryrun.py index 3c2508a94..5e6494a76 100644 --- a/tests/device_tests/reset_recovery/test_recovery_bip39_dryrun.py +++ b/tests/device_tests/reset_recovery/test_recovery_bip39_dryrun.py @@ -18,7 +18,7 @@ from typing import Any import pytest -from trezorlib import device, exceptions, messages +from trezorlib import device, exceptions, messages, models from trezorlib.debuglink import TrezorClientDebugLink as Client from ...common import MNEMONIC12 @@ -60,7 +60,7 @@ def do_recover_core(client: Client, mnemonic: list[str], mismatch: bool = False) def do_recover(client: Client, mnemonic: list[str], mismatch: bool = False): - if client.features.model == "1": + if client.model is models.T1B1: return do_recover_legacy(client, mnemonic) else: return do_recover_core(client, mnemonic, mismatch) @@ -80,15 +80,15 @@ def test_seed_mismatch(client: Client): do_recover(client, ["all"] * 12, mismatch=True) -@pytest.mark.skip_t2 -@pytest.mark.skip_tr +@pytest.mark.skip_t2t1 +@pytest.mark.skip_t2b1 @pytest.mark.skip_t3t1 def test_invalid_seed_t1(client: Client): with pytest.raises(exceptions.TrezorFailure, match="Invalid seed"): do_recover(client, ["stick"] * 12) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_invalid_seed_core(client: Client): with client: client.watch_layout() diff --git a/tests/device_tests/reset_recovery/test_recovery_bip39_t1.py b/tests/device_tests/reset_recovery/test_recovery_bip39_t1.py index bbdd0c373..4717a0f43 100644 --- a/tests/device_tests/reset_recovery/test_recovery_bip39_t1.py +++ b/tests/device_tests/reset_recovery/test_recovery_bip39_t1.py @@ -25,7 +25,7 @@ from ...common import MNEMONIC12 PIN4 = "1234" PIN6 = "789456" -pytestmark = [pytest.mark.skip_t2, pytest.mark.skip_tr, pytest.mark.skip_t3t1] +pytestmark = [pytest.mark.skip_t2t1, pytest.mark.skip_t2b1, pytest.mark.skip_t3t1] @pytest.mark.setup_client(uninitialized=True) diff --git a/tests/device_tests/reset_recovery/test_recovery_bip39_t2.py b/tests/device_tests/reset_recovery/test_recovery_bip39_t2.py index 21c4922c2..16ee1fb97 100644 --- a/tests/device_tests/reset_recovery/test_recovery_bip39_t2.py +++ b/tests/device_tests/reset_recovery/test_recovery_bip39_t2.py @@ -22,7 +22,7 @@ from trezorlib.debuglink import TrezorClientDebugLink as Client from ...common import MNEMONIC12 from ...input_flows import InputFlowBip39Recovery -pytestmark = pytest.mark.skip_t1 +pytestmark = pytest.mark.skip_t1b1 @pytest.mark.setup_client(uninitialized=True) diff --git a/tests/device_tests/reset_recovery/test_recovery_slip39_advanced.py b/tests/device_tests/reset_recovery/test_recovery_slip39_advanced.py index 5b6a4dbb0..8aaa4eb74 100644 --- a/tests/device_tests/reset_recovery/test_recovery_slip39_advanced.py +++ b/tests/device_tests/reset_recovery/test_recovery_slip39_advanced.py @@ -28,7 +28,7 @@ from ...input_flows import ( InputFlowSlip39AdvancedRecoveryThresholdReached, ) -pytestmark = pytest.mark.skip_t1 +pytestmark = pytest.mark.skip_t1b1 EXTRA_GROUP_SHARE = [ "eraser senior decision smug corner ruin rescue cubic angel tackle skin skunk program roster trash rumor slush angel flea amazing" diff --git a/tests/device_tests/reset_recovery/test_recovery_slip39_advanced_dryrun.py b/tests/device_tests/reset_recovery/test_recovery_slip39_advanced_dryrun.py index f64875d4e..b8261effc 100644 --- a/tests/device_tests/reset_recovery/test_recovery_slip39_advanced_dryrun.py +++ b/tests/device_tests/reset_recovery/test_recovery_slip39_advanced_dryrun.py @@ -23,7 +23,7 @@ from trezorlib.exceptions import TrezorFailure from ...common import MNEMONIC_SLIP39_ADVANCED_20 from ...input_flows import InputFlowSlip39AdvancedRecoveryDryRun -pytestmark = pytest.mark.skip_t1 +pytestmark = pytest.mark.skip_t1b1 INVALID_SHARES_SLIP39_ADVANCED_20 = [ "chest garlic acrobat leaf diploma thank soul predator grant laundry camera license language likely slim twice amount rich total carve", diff --git a/tests/device_tests/reset_recovery/test_recovery_slip39_basic.py b/tests/device_tests/reset_recovery/test_recovery_slip39_basic.py index b80569c71..bd4668b34 100644 --- a/tests/device_tests/reset_recovery/test_recovery_slip39_basic.py +++ b/tests/device_tests/reset_recovery/test_recovery_slip39_basic.py @@ -33,7 +33,7 @@ from ...input_flows import ( InputFlowSlip39BasicRecoveryWrongNthWord, ) -pytestmark = pytest.mark.skip_t1 +pytestmark = pytest.mark.skip_t1b1 MNEMONIC_SLIP39_BASIC_20_1of1 = [ "academic academic academic academic academic academic academic academic academic academic academic academic academic academic academic academic academic rebuild aquatic spew" diff --git a/tests/device_tests/reset_recovery/test_recovery_slip39_basic_dryrun.py b/tests/device_tests/reset_recovery/test_recovery_slip39_basic_dryrun.py index 35b559070..0575828fe 100644 --- a/tests/device_tests/reset_recovery/test_recovery_slip39_basic_dryrun.py +++ b/tests/device_tests/reset_recovery/test_recovery_slip39_basic_dryrun.py @@ -22,7 +22,7 @@ from trezorlib.exceptions import TrezorFailure from ...input_flows import InputFlowSlip39BasicRecoveryDryRun -pytestmark = pytest.mark.skip_t1 +pytestmark = pytest.mark.skip_t1b1 SHARES_20_2of3 = [ "crush merchant academic acid dream decision orbit smug trend trust painting slice glad crunch veteran lunch friar satoshi engage aquatic", diff --git a/tests/device_tests/reset_recovery/test_reset_backup.py b/tests/device_tests/reset_recovery/test_reset_backup.py index eecc61957..4b8d03a51 100644 --- a/tests/device_tests/reset_recovery/test_reset_backup.py +++ b/tests/device_tests/reset_recovery/test_reset_backup.py @@ -71,7 +71,7 @@ VECTORS = [ ] -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.parametrize("backup_type, backup_flow", VECTORS) @pytest.mark.setup_client(uninitialized=True) def test_skip_backup_msg(client: Client, backup_type, backup_flow): @@ -104,7 +104,7 @@ def test_skip_backup_msg(client: Client, backup_type, backup_flow): assert state.mnemonic_secret == secret -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.parametrize("backup_type, backup_flow", VECTORS) @pytest.mark.setup_client(uninitialized=True) def test_skip_backup_manual(client: Client, backup_type: BackupType, backup_flow): diff --git a/tests/device_tests/reset_recovery/test_reset_bip39_skipbackup.py b/tests/device_tests/reset_recovery/test_reset_bip39_skipbackup.py index 29b5f144b..0492fda5d 100644 --- a/tests/device_tests/reset_recovery/test_reset_bip39_skipbackup.py +++ b/tests/device_tests/reset_recovery/test_reset_bip39_skipbackup.py @@ -22,7 +22,7 @@ from trezorlib.debuglink import TrezorClientDebugLink as Client from ...common import EXTERNAL_ENTROPY, generate_entropy -pytestmark = [pytest.mark.skip_t2, pytest.mark.skip_tr, pytest.mark.skip_t3t1] +pytestmark = [pytest.mark.skip_t2t1, pytest.mark.skip_t2b1, pytest.mark.skip_t3t1] STRENGTH = 128 diff --git a/tests/device_tests/reset_recovery/test_reset_bip39_t1.py b/tests/device_tests/reset_recovery/test_reset_bip39_t1.py index 01ca7ef18..a43a8c2e3 100644 --- a/tests/device_tests/reset_recovery/test_reset_bip39_t1.py +++ b/tests/device_tests/reset_recovery/test_reset_bip39_t1.py @@ -23,7 +23,7 @@ from trezorlib.tools import parse_path from ...common import EXTERNAL_ENTROPY, generate_entropy -pytestmark = [pytest.mark.skip_t2, pytest.mark.skip_tr, pytest.mark.skip_t3t1] +pytestmark = [pytest.mark.skip_t2t1, pytest.mark.skip_t2b1, pytest.mark.skip_t3t1] def reset_device(client: Client, strength: int): diff --git a/tests/device_tests/reset_recovery/test_reset_bip39_t2.py b/tests/device_tests/reset_recovery/test_reset_bip39_t2.py index a30c6007e..f7235d6b5 100644 --- a/tests/device_tests/reset_recovery/test_reset_bip39_t2.py +++ b/tests/device_tests/reset_recovery/test_reset_bip39_t2.py @@ -17,7 +17,7 @@ import pytest from mnemonic import Mnemonic -from trezorlib import device, messages +from trezorlib import device, messages, models from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.exceptions import TrezorFailure @@ -28,7 +28,7 @@ from ...input_flows import ( InputFlowBip39ResetPIN, ) -pytestmark = [pytest.mark.skip_t1] +pytestmark = [pytest.mark.skip_t1b1] def reset_device(client: Client, strength: int): @@ -164,7 +164,7 @@ def test_failed_pin(client: Client): ret = client.call_raw(messages.ButtonAck()) # Re-enter PIN for TR - if client.debug.model == "Safe 3": + if client.model is models.T2B1: assert isinstance(ret, messages.ButtonRequest) client.debug.press_yes() ret = client.call_raw(messages.ButtonAck()) diff --git a/tests/device_tests/reset_recovery/test_reset_recovery_bip39.py b/tests/device_tests/reset_recovery/test_reset_recovery_bip39.py index 5b2e93458..56e55d354 100644 --- a/tests/device_tests/reset_recovery/test_reset_recovery_bip39.py +++ b/tests/device_tests/reset_recovery/test_reset_recovery_bip39.py @@ -25,7 +25,7 @@ from ...common import WITH_MOCK_URANDOM from ...input_flows import InputFlowBip39Recovery, InputFlowBip39ResetBackup -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.setup_client(uninitialized=True) def test_reset_recovery(client: Client): mnemonic = reset(client) diff --git a/tests/device_tests/reset_recovery/test_reset_recovery_slip39_advanced.py b/tests/device_tests/reset_recovery/test_reset_recovery_slip39_advanced.py index f594d6167..1945ba485 100644 --- a/tests/device_tests/reset_recovery/test_reset_recovery_slip39_advanced.py +++ b/tests/device_tests/reset_recovery/test_reset_recovery_slip39_advanced.py @@ -28,7 +28,7 @@ from ...input_flows import ( ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.setup_client(uninitialized=True) def test_reset_recovery(client: Client): mnemonics = reset(client) diff --git a/tests/device_tests/reset_recovery/test_reset_recovery_slip39_basic.py b/tests/device_tests/reset_recovery/test_reset_recovery_slip39_basic.py index a998c8d3a..9d3b45275 100644 --- a/tests/device_tests/reset_recovery/test_reset_recovery_slip39_basic.py +++ b/tests/device_tests/reset_recovery/test_reset_recovery_slip39_basic.py @@ -30,7 +30,7 @@ from ...input_flows import ( ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.setup_client(uninitialized=True) @WITH_MOCK_URANDOM def test_reset_recovery(client: Client): diff --git a/tests/device_tests/reset_recovery/test_reset_slip39_advanced.py b/tests/device_tests/reset_recovery/test_reset_slip39_advanced.py index b8b3eeb85..b1e8aa6f9 100644 --- a/tests/device_tests/reset_recovery/test_reset_slip39_advanced.py +++ b/tests/device_tests/reset_recovery/test_reset_slip39_advanced.py @@ -25,7 +25,7 @@ from trezorlib.messages import BackupType from ...common import EXTERNAL_ENTROPY, WITH_MOCK_URANDOM, generate_entropy from ...input_flows import InputFlowSlip39AdvancedResetRecovery -pytestmark = [pytest.mark.skip_t1] +pytestmark = [pytest.mark.skip_t1b1] # TODO: test with different options diff --git a/tests/device_tests/reset_recovery/test_reset_slip39_basic.py b/tests/device_tests/reset_recovery/test_reset_slip39_basic.py index 7321ce628..20c008631 100644 --- a/tests/device_tests/reset_recovery/test_reset_slip39_basic.py +++ b/tests/device_tests/reset_recovery/test_reset_slip39_basic.py @@ -27,7 +27,7 @@ from trezorlib.messages import BackupType from ...common import EXTERNAL_ENTROPY, WITH_MOCK_URANDOM, generate_entropy from ...input_flows import InputFlowSlip39BasicResetRecovery -pytestmark = [pytest.mark.skip_t1] +pytestmark = [pytest.mark.skip_t1b1] def reset_device(client: Client, strength: int): diff --git a/tests/device_tests/ripple/test_get_address.py b/tests/device_tests/ripple/test_get_address.py index 027b8b7e4..c2380c4a7 100644 --- a/tests/device_tests/ripple/test_get_address.py +++ b/tests/device_tests/ripple/test_get_address.py @@ -31,7 +31,7 @@ CUSTOM_MNEMONIC = ( pytestmark = [ pytest.mark.altcoin, pytest.mark.ripple, - pytest.mark.skip_t1, # T1 support is not planned + pytest.mark.skip_t1b1, # T1 support is not planned ] # data from https://iancoleman.io/bip39/ diff --git a/tests/device_tests/ripple/test_sign_tx.py b/tests/device_tests/ripple/test_sign_tx.py index 2dac93378..ddf020142 100644 --- a/tests/device_tests/ripple/test_sign_tx.py +++ b/tests/device_tests/ripple/test_sign_tx.py @@ -24,7 +24,7 @@ from trezorlib.tools import parse_path pytestmark = [ pytest.mark.altcoin, pytest.mark.ripple, - pytest.mark.skip_t1, # T1 support is not planned + pytest.mark.skip_t1b1, # T1 support is not planned ] diff --git a/tests/device_tests/solana/test_address.py b/tests/device_tests/solana/test_address.py index 0a14a02e3..e33d5ff60 100644 --- a/tests/device_tests/solana/test_address.py +++ b/tests/device_tests/solana/test_address.py @@ -25,7 +25,7 @@ from ...common import parametrize_using_common_fixtures pytestmark = [ pytest.mark.altcoin, pytest.mark.solana, - pytest.mark.skip_t1, + pytest.mark.skip_t1b1, ] diff --git a/tests/device_tests/solana/test_public_key.py b/tests/device_tests/solana/test_public_key.py index 90cc17e31..9c36ef3b8 100644 --- a/tests/device_tests/solana/test_public_key.py +++ b/tests/device_tests/solana/test_public_key.py @@ -25,7 +25,7 @@ from ...common import parametrize_using_common_fixtures pytestmark = [ pytest.mark.altcoin, pytest.mark.solana, - pytest.mark.skip_t1, + pytest.mark.skip_t1b1, ] diff --git a/tests/device_tests/solana/test_sign_tx.py b/tests/device_tests/solana/test_sign_tx.py index ce0e65de6..5577d9914 100644 --- a/tests/device_tests/solana/test_sign_tx.py +++ b/tests/device_tests/solana/test_sign_tx.py @@ -28,7 +28,7 @@ from .construct.transaction import Message, RawInstruction pytestmark = [ pytest.mark.altcoin, pytest.mark.solana, - pytest.mark.skip_t1, + pytest.mark.skip_t1b1, ] diff --git a/tests/device_tests/stellar/test_stellar.py b/tests/device_tests/stellar/test_stellar.py index 12c356a6d..3fdaa329f 100644 --- a/tests/device_tests/stellar/test_stellar.py +++ b/tests/device_tests/stellar/test_stellar.py @@ -119,7 +119,7 @@ def test_get_address(client: Client, parameters, result): assert address == result["address"] -@pytest.mark.skip_t1("No input flow for T1") +@pytest.mark.skip_t1b1("No input flow for T1") @parametrize_using_common_fixtures("stellar/get_address.json") def test_get_address_chunkify_details(client: Client, parameters, result): with client: diff --git a/tests/device_tests/test_authenticate_device.py b/tests/device_tests/test_authenticate_device.py index 7d1e9b6da..4db77708b 100644 --- a/tests/device_tests/test_authenticate_device.py +++ b/tests/device_tests/test_authenticate_device.py @@ -9,7 +9,7 @@ from trezorlib.debuglink import TrezorClientDebugLink as Client from ..common import compact_size -pytestmark = [pytest.mark.skip_t1, pytest.mark.skip_t2] +pytestmark = [pytest.mark.skip_t1b1, pytest.mark.skip_t2t1] ROOT_PUBLIC_KEY = bytes.fromhex( "047f77368dea2d4d61e989f474a56723c3212dacf8a808d8795595ef38441427c4389bc454f02089d7f08b873005e4c28d432468997871c0bf286fd3861e21e96a" diff --git a/tests/device_tests/test_autolock.py b/tests/device_tests/test_autolock.py index 51fac0593..92c14e072 100644 --- a/tests/device_tests/test_autolock.py +++ b/tests/device_tests/test_autolock.py @@ -18,7 +18,7 @@ import time import pytest -from trezorlib import device, messages +from trezorlib import device, messages, models from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.exceptions import TrezorFailure @@ -32,7 +32,7 @@ pytestmark = pytest.mark.setup_client(pin=PIN4) def pin_request(client: Client): return ( messages.PinMatrixRequest - if client.features.model == "1" + if client.model is models.T1B1 else messages.ButtonRequest ) @@ -111,7 +111,7 @@ def test_apply_auto_lock_delay_out_of_range(client: Client, seconds): device.apply_settings(client, auto_lock_delay_ms=delay) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_autolock_cancels_ui(client: Client): set_autolock_delay(client, 10 * 1000) diff --git a/tests/device_tests/test_bip32_speed.py b/tests/device_tests/test_bip32_speed.py index 82e365c47..cca019805 100644 --- a/tests/device_tests/test_bip32_speed.py +++ b/tests/device_tests/test_bip32_speed.py @@ -24,8 +24,8 @@ from trezorlib.messages import SafetyCheckLevel from trezorlib.tools import H_ pytestmark = [ - pytest.mark.skip_t2, - pytest.mark.skip_tr, + pytest.mark.skip_t2t1, + pytest.mark.skip_t2b1, pytest.mark.skip_t3t1, pytest.mark.flaky(max_runs=5), ] diff --git a/tests/device_tests/test_busy_state.py b/tests/device_tests/test_busy_state.py index 23c354a0d..6f834835f 100644 --- a/tests/device_tests/test_busy_state.py +++ b/tests/device_tests/test_busy_state.py @@ -18,7 +18,7 @@ import time import pytest -from trezorlib import btc, device +from trezorlib import btc, device, models from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.tools import parse_path diff --git a/tests/device_tests/test_cancel.py b/tests/device_tests/test_cancel.py index ff831bfdc..f99fbb2f4 100644 --- a/tests/device_tests/test_cancel.py +++ b/tests/device_tests/test_cancel.py @@ -17,6 +17,7 @@ import pytest import trezorlib.messages as m +from trezorlib import models from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.exceptions import Cancelled @@ -70,7 +71,7 @@ def test_cancel_message_via_initialize(client: Client, message): assert isinstance(resp, m.Features) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_cancel_on_paginated(client: Client): """Check that device is responsive on paginated screen. See #1708.""" # In #1708, the device would ignore USB (or UDP) events while waiting for the user @@ -91,9 +92,9 @@ def test_cancel_on_paginated(client: Client): resp = client._raw_read() assert isinstance(resp, m.ButtonRequest) - # In TR, confirm message is no longer paginated by default, + # In T2B1, confirm message is no longer paginated by default, # user needs to click info button - if client.debug.model == "Safe 3": + if client.model is models.T2B1: client._raw_write(m.ButtonAck()) client.debug.press_right() resp = client._raw_read() diff --git a/tests/device_tests/test_debuglink.py b/tests/device_tests/test_debuglink.py index 16c093186..4e6a94d58 100644 --- a/tests/device_tests/test_debuglink.py +++ b/tests/device_tests/test_debuglink.py @@ -24,16 +24,16 @@ from trezorlib.transport import udp from ..common import MNEMONIC12 -@pytest.mark.skip_t2 -@pytest.mark.skip_tr +@pytest.mark.skip_t2t1 +@pytest.mark.skip_t2b1 @pytest.mark.skip_t3t1 def test_layout(client: Client): layout = client.debug.state().layout assert len(layout) == 1024 -@pytest.mark.skip_t2 -@pytest.mark.skip_tr +@pytest.mark.skip_t2t1 +@pytest.mark.skip_t2b1 @pytest.mark.skip_t3t1 @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_mnemonic(client: Client): @@ -42,8 +42,8 @@ def test_mnemonic(client: Client): assert mnemonic == MNEMONIC12.encode() -@pytest.mark.skip_t2 -@pytest.mark.skip_tr +@pytest.mark.skip_t2t1 +@pytest.mark.skip_t2b1 @pytest.mark.skip_t3t1 @pytest.mark.setup_client(mnemonic=MNEMONIC12, pin="1234", passphrase="") def test_pin(client: Client): @@ -62,7 +62,7 @@ def test_pin(client: Client): assert isinstance(resp, messages.Address) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_softlock_instability(client: Client): def load_device(): debuglink.load_device( diff --git a/tests/device_tests/test_language.py b/tests/device_tests/test_language.py index 363185f62..d66fa9a2d 100644 --- a/tests/device_tests/test_language.py +++ b/tests/device_tests/test_language.py @@ -24,7 +24,7 @@ from trezorlib.debuglink import TrezorClientDebugLink as Client from ..translations import LANGUAGES, build_and_sign_blob, get_lang_json, set_language -pytestmark = pytest.mark.skip_t1 +pytestmark = pytest.mark.skip_t1b1 MAX_DATA_LENGTH = { diff --git a/tests/device_tests/test_msg_applysettings.py b/tests/device_tests/test_msg_applysettings.py index 609a70cb0..78f7166e8 100644 --- a/tests/device_tests/test_msg_applysettings.py +++ b/tests/device_tests/test_msg_applysettings.py @@ -18,7 +18,7 @@ from pathlib import Path import pytest -from trezorlib import btc, device, exceptions, messages, misc +from trezorlib import btc, device, exceptions, messages, misc, models from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.tools import parse_path @@ -50,7 +50,7 @@ TR_HOMESCREEN = b"TOIG\x80\x00@\x00\x0c\x04\x00\x00\xa5RY\x96\xdc0\x08\xe4\x06\x def _set_expected_responses(client: Client): client.use_pin_sequence([PIN4]) - if client.features.model == "1": + if client.model is models.T1B1: client.set_expected_responses(EXPECTED_RESPONSES_PIN_T1) else: client.set_expected_responses(EXPECTED_RESPONSES_PIN_TT) @@ -66,7 +66,7 @@ def test_apply_settings(client: Client): assert client.features.label == "new label" -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_apply_settings_rotation(client: Client): assert client.features.display_rotation is None @@ -99,7 +99,7 @@ def test_apply_settings_passphrase(client: Client): @pytest.mark.setup_client(passphrase=False) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_apply_settings_passphrase_on_device(client: Client): # enable passphrase with client: @@ -133,8 +133,8 @@ def test_apply_settings_passphrase_on_device(client: Client): assert client.features.passphrase_always_on_device is False -@pytest.mark.skip_t1 -@pytest.mark.skip_t2 +@pytest.mark.skip_t1b1 +@pytest.mark.skip_t2t1 @pytest.mark.skip_t3t1 def test_apply_homescreen_tr_toif_good(client: Client): with client: @@ -146,8 +146,8 @@ def test_apply_homescreen_tr_toif_good(client: Client): device.apply_settings(client, homescreen=b"") -@pytest.mark.skip_t1 -@pytest.mark.skip_t2 +@pytest.mark.skip_t1b1 +@pytest.mark.skip_t2t1 @pytest.mark.skip_t3t1 @pytest.mark.setup_client(pin=None) # so that "PIN NOT SET" is shown in the header def test_apply_homescreen_tr_toif_with_notification(client: Client): @@ -156,8 +156,8 @@ def test_apply_homescreen_tr_toif_with_notification(client: Client): device.apply_settings(client, homescreen=TR_HOMESCREEN) -@pytest.mark.skip_t1 -@pytest.mark.skip_t2 +@pytest.mark.skip_t1b1 +@pytest.mark.skip_t2t1 @pytest.mark.skip_t3t1 def test_apply_homescreen_tr_toif_with_long_label(client: Client): with client: @@ -173,8 +173,8 @@ def test_apply_homescreen_tr_toif_with_long_label(client: Client): device.apply_settings(client, label="My even longer label") -@pytest.mark.skip_t1 -@pytest.mark.skip_t2 +@pytest.mark.skip_t1b1 +@pytest.mark.skip_t2t1 @pytest.mark.skip_t3t1 def test_apply_homescreen_tr_toif_wrong_size(client: Client): # 64x64 img @@ -184,8 +184,8 @@ def test_apply_homescreen_tr_toif_wrong_size(client: Client): device.apply_settings(client, homescreen=img) -@pytest.mark.skip_t1 -@pytest.mark.skip_t2 +@pytest.mark.skip_t1b1 +@pytest.mark.skip_t2t1 @pytest.mark.skip_t3t1 def test_apply_homescreen_tr_upload_jpeg_fail(client: Client): with open(HERE / "test_bg.jpg", "rb") as f: @@ -195,8 +195,8 @@ def test_apply_homescreen_tr_upload_jpeg_fail(client: Client): device.apply_settings(client, homescreen=img) -@pytest.mark.skip_t1 -@pytest.mark.skip_t2 +@pytest.mark.skip_t1b1 +@pytest.mark.skip_t2t1 @pytest.mark.skip_t3t1 def test_apply_homescreen_tr_upload_t1_fail(client: Client): with pytest.raises(exceptions.TrezorFailure), client: @@ -204,8 +204,8 @@ def test_apply_homescreen_tr_upload_t1_fail(client: Client): device.apply_settings(client, homescreen=T1_HOMESCREEN) -@pytest.mark.skip_t1 -@pytest.mark.skip_tr +@pytest.mark.skip_t1b1 +@pytest.mark.skip_t2b1 def test_apply_homescreen_toif(client: Client): img = b"TOIf\x90\x00\x90\x00~\x00\x00\x00\xed\xd2\xcb\r\x83@\x10D\xc1^.\xde#!\xac31\x99\x10\x8aC%\x14~\x16\x92Y9\x02WI3\x01<\xf5cI2d\x1es(\xe1[\xdbn\xba\xca\xe8s7\xa4\xd5\xd4\xb3\x13\xbdw\xf6:\xf3\xd1\xe7%\xc7]\xdd_\xb3\x9e\x9f\x9e\x9fN\xed\xaaE\xef\xdc\xcf$D\xa7\xa4X\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0OV" @@ -214,8 +214,8 @@ def test_apply_homescreen_toif(client: Client): device.apply_settings(client, homescreen=img) -@pytest.mark.skip_t1 -@pytest.mark.skip_tr +@pytest.mark.skip_t1b1 +@pytest.mark.skip_t2b1 def test_apply_homescreen_jpeg(client: Client): with open(HERE / "test_bg.jpg", "rb") as f: img = f.read() @@ -227,8 +227,8 @@ def test_apply_homescreen_jpeg(client: Client): device.apply_settings(client, homescreen=b"") -@pytest.mark.skip_t1 -@pytest.mark.skip_tr +@pytest.mark.skip_t1b1 +@pytest.mark.skip_t2b1 def test_apply_homescreen_jpeg_progressive(client: Client): img = ( b"\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x01,\x01," @@ -284,8 +284,8 @@ def test_apply_homescreen_jpeg_progressive(client: Client): device.apply_settings(client, homescreen=img) -@pytest.mark.skip_t1 -@pytest.mark.skip_tr +@pytest.mark.skip_t1b1 +@pytest.mark.skip_t2b1 def test_apply_homescreen_jpeg_wrong_size(client: Client): img = ( b"\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x01,\x01," @@ -331,8 +331,8 @@ def test_apply_homescreen_jpeg_wrong_size(client: Client): device.apply_settings(client, homescreen=img) -@pytest.mark.skip_t2 -@pytest.mark.skip_tr +@pytest.mark.skip_t2t1 +@pytest.mark.skip_t2b1 @pytest.mark.skip_t3t1 def test_apply_homescreen(client: Client): with client: @@ -351,7 +351,7 @@ def test_safety_checks(client: Client): client.set_expected_responses([messages.Failure]) get_bad_address() - if client.features.model != "1": + if client.model is not models.T1B1: with client: client.set_expected_responses(EXPECTED_RESPONSES_NOPIN) device.apply_settings( @@ -391,7 +391,7 @@ def test_safety_checks(client: Client): get_bad_address() -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_experimental_features(client: Client): def experimental_call(): misc.get_nonce(client) diff --git a/tests/device_tests/test_msg_backup_device.py b/tests/device_tests/test_msg_backup_device.py index bdcecd67e..ee4939659 100644 --- a/tests/device_tests/test_msg_backup_device.py +++ b/tests/device_tests/test_msg_backup_device.py @@ -18,7 +18,7 @@ import pytest import shamir_mnemonic as shamir -from trezorlib import device, messages +from trezorlib import device, messages, models from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.exceptions import TrezorFailure @@ -34,7 +34,7 @@ from ..input_flows import ( ) -@pytest.mark.skip_t1 # TODO we want this for t1 too +@pytest.mark.skip_t1b1 # TODO we want this for t1 too @pytest.mark.setup_client(needs_backup=True, mnemonic=MNEMONIC12) def test_backup_bip39(client: Client): assert client.features.needs_backup is True @@ -53,14 +53,14 @@ def test_backup_bip39(client: Client): assert client.features.backup_type is messages.BackupType.Bip39 -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.setup_client(needs_backup=True, mnemonic=MNEMONIC_SLIP39_BASIC_20_3of6) @pytest.mark.parametrize( "click_info", [True, False], ids=["click_info", "no_click_info"] ) def test_backup_slip39_basic(client: Client, click_info: bool): - if click_info and client.features.model == "Safe 3": - pytest.skip("click_info not implemented on TR") + if click_info and client.model is models.T2B1: + pytest.skip("click_info not implemented on T2B1") assert client.features.needs_backup is True @@ -81,14 +81,14 @@ def test_backup_slip39_basic(client: Client, click_info: bool): assert expected_ms == actual_ms -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.setup_client(needs_backup=True, mnemonic=MNEMONIC_SLIP39_ADVANCED_20) @pytest.mark.parametrize( "click_info", [True, False], ids=["click_info", "no_click_info"] ) def test_backup_slip39_advanced(client: Client, click_info: bool): - if click_info and client.features.model == "Safe 3": - pytest.skip("click_info not implemented on TR") + if click_info and client.model is models.T2B1: + pytest.skip("click_info not implemented on T2B1") assert client.features.needs_backup is True diff --git a/tests/device_tests/test_msg_change_wipe_code_t1.py b/tests/device_tests/test_msg_change_wipe_code_t1.py index 2fda2ef8e..a4cbc8d16 100644 --- a/tests/device_tests/test_msg_change_wipe_code_t1.py +++ b/tests/device_tests/test_msg_change_wipe_code_t1.py @@ -29,7 +29,7 @@ WIPE_CODE6 = "456789" WIPE_CODE_MAX = "".join(chr((i % 9) + ord("1")) for i in range(MAX_PIN_LENGTH)) WIPE_CODE_TOO_LONG = WIPE_CODE_MAX + "1" -pytestmark = [pytest.mark.skip_t2, pytest.mark.skip_tr, pytest.mark.skip_t3t1] +pytestmark = [pytest.mark.skip_t2t1, pytest.mark.skip_t2b1, pytest.mark.skip_t3t1] def _set_wipe_code(client: Client, pin, wipe_code): diff --git a/tests/device_tests/test_msg_change_wipe_code_t2.py b/tests/device_tests/test_msg_change_wipe_code_t2.py index 5dc0a99d0..f3b559174 100644 --- a/tests/device_tests/test_msg_change_wipe_code_t2.py +++ b/tests/device_tests/test_msg_change_wipe_code_t2.py @@ -28,7 +28,7 @@ WIPE_CODE4 = "4321" WIPE_CODE6 = "456789" WIPE_CODE_MAX = "".join(chr((i % 10) + ord("0")) for i in range(MAX_PIN_LENGTH)) -pytestmark = pytest.mark.skip_t1 +pytestmark = pytest.mark.skip_t1b1 def _check_wipe_code(client: Client, pin: str, wipe_code: str): diff --git a/tests/device_tests/test_msg_changepin_t1.py b/tests/device_tests/test_msg_changepin_t1.py index dd4759958..b12ca38b1 100644 --- a/tests/device_tests/test_msg_changepin_t1.py +++ b/tests/device_tests/test_msg_changepin_t1.py @@ -28,7 +28,7 @@ PIN6 = "789456" PIN_MAX = "".join(chr((i % 9) + ord("1")) for i in range(MAX_PIN_LENGTH)) PIN_TOO_LONG = PIN_MAX + "1" -pytestmark = [pytest.mark.skip_t2, pytest.mark.skip_tr, pytest.mark.skip_t3t1] +pytestmark = [pytest.mark.skip_t2t1, pytest.mark.skip_t2b1, pytest.mark.skip_t3t1] def _check_pin(client: Client, pin): diff --git a/tests/device_tests/test_msg_changepin_t2.py b/tests/device_tests/test_msg_changepin_t2.py index c75efe172..301425e98 100644 --- a/tests/device_tests/test_msg_changepin_t2.py +++ b/tests/device_tests/test_msg_changepin_t2.py @@ -31,7 +31,7 @@ PIN4 = "1234" PIN60 = "789456" * 10 PIN_MAX = "".join(chr((i % 10) + ord("0")) for i in range(MAX_PIN_LENGTH)) -pytestmark = pytest.mark.skip_t1 +pytestmark = pytest.mark.skip_t1b1 def _check_pin(client: Client, pin: str): diff --git a/tests/device_tests/test_msg_loaddevice.py b/tests/device_tests/test_msg_loaddevice.py index 9f1de13d8..0bfd2c78c 100644 --- a/tests/device_tests/test_msg_loaddevice.py +++ b/tests/device_tests/test_msg_loaddevice.py @@ -16,7 +16,7 @@ import pytest -from trezorlib import debuglink, device +from trezorlib import debuglink, device, models from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.messages import BackupType @@ -59,7 +59,7 @@ def test_load_device_2(client: Client): state = client.debug.state() assert state.mnemonic_secret == MNEMONIC12.encode() - if client.features.model == "1": + if client.model is models.T1B1: # we do not send PIN in DebugLinkState in Core assert state.pin == "1234" assert state.passphrase_protection is True @@ -68,7 +68,7 @@ def test_load_device_2(client: Client): assert address == "mx77VZjTVixVsU7nCtAKHnGFdsyNCnsWWw" -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_load_device_slip39_basic(client: Client): debuglink.load_device( client, @@ -80,7 +80,7 @@ def test_load_device_slip39_basic(client: Client): assert client.features.backup_type == BackupType.Slip39_Basic -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_load_device_slip39_advanced(client: Client): debuglink.load_device( client, diff --git a/tests/device_tests/test_msg_sd_protect.py b/tests/device_tests/test_msg_sd_protect.py index 5a26e79e1..24447e0cb 100644 --- a/tests/device_tests/test_msg_sd_protect.py +++ b/tests/device_tests/test_msg_sd_protect.py @@ -23,7 +23,7 @@ from trezorlib.messages import SdProtectOperationType as Op from ..common import MNEMONIC12 -pytestmark = [pytest.mark.skip_t1, pytest.mark.skip_tr, pytest.mark.sd_card] +pytestmark = [pytest.mark.skip_t1b1, pytest.mark.skip_t2b1, pytest.mark.sd_card] def test_enable_disable(client: Client): diff --git a/tests/device_tests/test_passphrase_slip39_advanced.py b/tests/device_tests/test_passphrase_slip39_advanced.py index 608278095..549fc7bc6 100644 --- a/tests/device_tests/test_passphrase_slip39_advanced.py +++ b/tests/device_tests/test_passphrase_slip39_advanced.py @@ -26,7 +26,7 @@ from ..common import ( @pytest.mark.setup_client(mnemonic=MNEMONIC_SLIP39_ADVANCED_20, passphrase=True) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_128bit_passphrase(client: Client): """ BIP32 Root Key for passphrase TREZOR: @@ -45,7 +45,7 @@ def test_128bit_passphrase(client: Client): @pytest.mark.setup_client(mnemonic=MNEMONIC_SLIP39_ADVANCED_33, passphrase=True) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_256bit_passphrase(client: Client): """ BIP32 Root Key for passphrase TREZOR: diff --git a/tests/device_tests/test_passphrase_slip39_basic.py b/tests/device_tests/test_passphrase_slip39_basic.py index 627b91d78..df0977da8 100644 --- a/tests/device_tests/test_passphrase_slip39_basic.py +++ b/tests/device_tests/test_passphrase_slip39_basic.py @@ -22,7 +22,7 @@ from ..common import MNEMONIC_SLIP39_BASIC_20_3of6, get_test_address @pytest.mark.setup_client(mnemonic=MNEMONIC_SLIP39_BASIC_20_3of6, passphrase="TREZOR") -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_3of6_passphrase(client: Client): """ BIP32 Root Key for passphrase TREZOR: @@ -41,7 +41,7 @@ def test_3of6_passphrase(client: Client): ), passphrase="TREZOR", ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_2of5_passphrase(client: Client): """ BIP32 Root Key for passphrase TREZOR: diff --git a/tests/device_tests/test_pin.py b/tests/device_tests/test_pin.py index 96b1d674e..1dcadc28f 100644 --- a/tests/device_tests/test_pin.py +++ b/tests/device_tests/test_pin.py @@ -18,7 +18,7 @@ import time import pytest -from trezorlib import messages +from trezorlib import messages, models from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.exceptions import PinException @@ -42,7 +42,7 @@ def test_correct_pin(client: Client): with client: client.use_pin_sequence([PIN4]) # Expected responses differ between T1 and TT - is_t1 = client.features.model == "1" + is_t1 = client.model is models.T1B1 client.set_expected_responses( [ (is_t1, messages.PinMatrixRequest), @@ -57,8 +57,8 @@ def test_correct_pin(client: Client): get_test_address(client) -@pytest.mark.skip_t2 -@pytest.mark.skip_tr +@pytest.mark.skip_t2t1 +@pytest.mark.skip_t2b1 @pytest.mark.skip_t3t1 def test_incorrect_pin_t1(client: Client): with pytest.raises(PinException): @@ -66,7 +66,7 @@ def test_incorrect_pin_t1(client: Client): get_test_address(client) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_incorrect_pin_t2(client: Client): with client: # After first incorrect attempt, TT will not raise an error, but instead ask for another attempt @@ -81,8 +81,8 @@ def test_incorrect_pin_t2(client: Client): get_test_address(client) -@pytest.mark.skip_t2 -@pytest.mark.skip_tr +@pytest.mark.skip_t2t1 +@pytest.mark.skip_t2b1 @pytest.mark.skip_t3t1 def test_exponential_backoff_t1(client: Client): for attempt in range(3): @@ -93,7 +93,7 @@ def test_exponential_backoff_t1(client: Client): check_pin_backoff_time(attempt, start) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_exponential_backoff_t2(client: Client): with client: IF = InputFlowPINBackoff(client, BAD_PIN, PIN4) diff --git a/tests/device_tests/test_protection_levels.py b/tests/device_tests/test_protection_levels.py index cb48d49ad..85b762860 100644 --- a/tests/device_tests/test_protection_levels.py +++ b/tests/device_tests/test_protection_levels.py @@ -16,7 +16,7 @@ import pytest -from trezorlib import btc, device, messages, misc +from trezorlib import btc, device, messages, misc, models from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.exceptions import TrezorFailure from trezorlib.tools import parse_path @@ -44,7 +44,7 @@ pytestmark = pytest.mark.setup_client(pin=PIN4, passphrase=True) def _pin_request(client: Client): """Get appropriate PIN request for each model""" - if client.features.model == "1": + if client.model is models.T1B1: return messages.PinMatrixRequest else: return messages.ButtonRequest(code=B.PinEntry) @@ -69,7 +69,7 @@ def test_initialize(client: Client): client.init_device() -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.setup_client(pin=PIN4) @pytest.mark.parametrize("passphrase", (True, False)) def test_passphrase_reporting(client: Client, passphrase): @@ -110,8 +110,8 @@ def test_apply_settings(client: Client): device.apply_settings(client, label="nazdar") -@pytest.mark.skip_t2 -@pytest.mark.skip_tr +@pytest.mark.skip_t2t1 +@pytest.mark.skip_t2b1 @pytest.mark.skip_t3t1 def test_change_pin_t1(client: Client): _assert_protection(client) @@ -130,7 +130,7 @@ def test_change_pin_t1(client: Client): device.change_pin(client) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_change_pin_t2(client: Client): _assert_protection(client) with client: @@ -141,7 +141,7 @@ def test_change_pin_t2(client: Client): messages.ButtonRequest, _pin_request(client), _pin_request(client), - (client.debug.model == "Safe 3", messages.ButtonRequest), + (client.model is models.T2B1, messages.ButtonRequest), _pin_request(client), messages.ButtonRequest, messages.Success, @@ -211,8 +211,8 @@ def test_wipe_device(client: Client): @pytest.mark.setup_client(uninitialized=True) -@pytest.mark.skip_t2 -@pytest.mark.skip_tr +@pytest.mark.skip_t2t1 +@pytest.mark.skip_t2b1 @pytest.mark.skip_t3t1 def test_reset_device(client: Client): assert client.features.pin_protection is False @@ -241,8 +241,8 @@ def test_reset_device(client: Client): @pytest.mark.setup_client(uninitialized=True) -@pytest.mark.skip_t2 -@pytest.mark.skip_tr +@pytest.mark.skip_t2t1 +@pytest.mark.skip_t2b1 @pytest.mark.skip_t3t1 def test_recovery_device(client: Client): assert client.features.pin_protection is False @@ -295,8 +295,8 @@ def test_sign_message(client: Client): ) -@pytest.mark.skip_t2 -@pytest.mark.skip_tr +@pytest.mark.skip_t2t1 +@pytest.mark.skip_t2b1 @pytest.mark.skip_t3t1 def test_verify_message_t1(client: Client): _assert_protection(client) @@ -320,7 +320,7 @@ def test_verify_message_t1(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_verify_message_t2(client: Client): _assert_protection(client) with client: diff --git a/tests/device_tests/test_sdcard.py b/tests/device_tests/test_sdcard.py index a8953b403..6e00a07be 100644 --- a/tests/device_tests/test_sdcard.py +++ b/tests/device_tests/test_sdcard.py @@ -23,7 +23,7 @@ from trezorlib.messages import SdProtectOperationType as Op from .. import translations as TR -pytestmark = [pytest.mark.skip_t1, pytest.mark.skip_tr] +pytestmark = [pytest.mark.skip_t1b1, pytest.mark.skip_t2b1] @pytest.mark.sd_card(formatted=False) diff --git a/tests/device_tests/test_session.py b/tests/device_tests/test_session.py index 7c2e78639..0879bac9b 100644 --- a/tests/device_tests/test_session.py +++ b/tests/device_tests/test_session.py @@ -16,7 +16,7 @@ import pytest -from trezorlib import cardano, messages +from trezorlib import cardano, messages, models from trezorlib.btc import get_public_node from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.exceptions import TrezorFailure @@ -32,7 +32,7 @@ PIN4 = "1234" @pytest.mark.setup_client(pin=PIN4, passphrase="") def test_clear_session(client: Client): - is_t1 = client.features.model == "1" + is_t1 = client.model is models.T1B1 init_responses = [ messages.PinMatrixRequest if is_t1 else messages.ButtonRequest, messages.PassphraseRequest, @@ -159,7 +159,7 @@ def test_session_recycling(client: Client): @pytest.mark.altcoin @pytest.mark.cardano -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_derive_cardano_empty_session(client: Client): # start new session client.init_device(new_session=True) @@ -178,7 +178,7 @@ def test_derive_cardano_empty_session(client: Client): @pytest.mark.altcoin @pytest.mark.cardano -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_derive_cardano_running_session(client: Client): # start new session client.init_device(new_session=True) diff --git a/tests/device_tests/test_session_id_and_passphrase.py b/tests/device_tests/test_session_id_and_passphrase.py index 12e36e1cc..ee197be84 100644 --- a/tests/device_tests/test_session_id_and_passphrase.py +++ b/tests/device_tests/test_session_id_and_passphrase.py @@ -241,7 +241,7 @@ def test_session_enable_passphrase(client: Client): assert _get_xpub(client, passphrase="A") == XPUB_PASSPHRASES["A"] -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.setup_client(passphrase=True) def test_passphrase_on_device(client: Client): _init_session(client) @@ -280,7 +280,7 @@ def test_passphrase_on_device(client: Client): assert response.xpub == XPUB_PASSPHRASES["A"] -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.setup_client(passphrase=True) def test_passphrase_always_on_device(client: Client): # Let's start the communication by calling Initialize. @@ -314,8 +314,8 @@ def test_passphrase_always_on_device(client: Client): assert response.xpub == XPUB_PASSPHRASES["A"] -@pytest.mark.skip_t2 -@pytest.mark.skip_tr +@pytest.mark.skip_t2t1 +@pytest.mark.skip_t2b1 @pytest.mark.skip_t3t1 @pytest.mark.setup_client(passphrase="") def test_passphrase_on_device_not_possible_on_t1(client: Client): @@ -380,7 +380,7 @@ def test_passphrase_length(client: Client): call(passphrase="A" * 49 + "ลก", expected_result=False) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.setup_client(passphrase=True) def test_hide_passphrase_from_host(client: Client): # Without safety checks, turning it on fails @@ -480,7 +480,7 @@ def _get_xpub_cardano(client: Client, passphrase): return response.xpub -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.altcoin @pytest.mark.setup_client(passphrase=True) def test_cardano_passphrase(client: Client): diff --git a/tests/device_tests/tezos/test_getaddress.py b/tests/device_tests/tezos/test_getaddress.py index b6683b2f0..857d21b8e 100644 --- a/tests/device_tests/tezos/test_getaddress.py +++ b/tests/device_tests/tezos/test_getaddress.py @@ -25,7 +25,7 @@ from ...input_flows import InputFlowShowAddressQRCode pytestmark = [ pytest.mark.altcoin, pytest.mark.tezos, - pytest.mark.skip_t1, + pytest.mark.skip_t1b1, ] TEST_VECTORS = [ diff --git a/tests/device_tests/tezos/test_getpublickey.py b/tests/device_tests/tezos/test_getpublickey.py index afd39eb5a..279580fd0 100644 --- a/tests/device_tests/tezos/test_getpublickey.py +++ b/tests/device_tests/tezos/test_getpublickey.py @@ -23,7 +23,7 @@ from trezorlib.tools import parse_path @pytest.mark.altcoin @pytest.mark.tezos -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_tezos_get_public_key(client: Client): path = parse_path("m/44h/1729h/0h") pk = get_public_key(client, path) diff --git a/tests/device_tests/tezos/test_sign_tx.py b/tests/device_tests/tezos/test_sign_tx.py index f4a729b54..7b54db93d 100644 --- a/tests/device_tests/tezos/test_sign_tx.py +++ b/tests/device_tests/tezos/test_sign_tx.py @@ -28,7 +28,7 @@ TEZOS_PATH_15 = parse_path("m/44h/1729h/15h") pytestmark = [ pytest.mark.altcoin, pytest.mark.tezos, - pytest.mark.skip_t1, + pytest.mark.skip_t1b1, ] diff --git a/tests/device_tests/webauthn/test_msg_webauthn.py b/tests/device_tests/webauthn/test_msg_webauthn.py index 7c02c27cf..4027c2b0c 100644 --- a/tests/device_tests/webauthn/test_msg_webauthn.py +++ b/tests/device_tests/webauthn/test_msg_webauthn.py @@ -26,7 +26,7 @@ from .data_webauthn import CRED1, CRED2, CRED3, CREDS RK_CAPACITY = 100 -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 @pytest.mark.altcoin @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_add_remove(client: Client): diff --git a/tests/device_tests/zcash/test_sign_tx.py b/tests/device_tests/zcash/test_sign_tx.py index c321324d8..b68023772 100644 --- a/tests/device_tests/zcash/test_sign_tx.py +++ b/tests/device_tests/zcash/test_sign_tx.py @@ -276,7 +276,7 @@ def test_one_two(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_unified_address(client: Client): # identical to the test_one_two # but receiver address is unified with an orchard address @@ -334,7 +334,7 @@ def test_unified_address(client: Client): ) -@pytest.mark.skip_t1 +@pytest.mark.skip_t1b1 def test_external_presigned(client: Client): inp1 = messages.TxInputType( # tmQoJ3PTXgQLaRRZZYT6xk8XtjRbr2kCqwu diff --git a/tests/ui_tests/common.py b/tests/ui_tests/common.py index ab60c11b4..9b9b7834a 100644 --- a/tests/ui_tests/common.py +++ b/tests/ui_tests/common.py @@ -234,17 +234,17 @@ class TestCase: @classmethod def build(cls, client: Client, request: pytest.FixtureRequest) -> Self: - # FIXME - if client.model is models.T2B1: - model_name = "R" - else: - model_name = client.model.name + model_name = { + models.T1B1: "T1", + models.T2T1: "TT", + models.T2B1: "TR", + }.get(client.model, client.model.internal_name) name, group = _get_test_name_and_group(request.node.nodeid) full_language = client.features.language assert full_language language = full_language[:2] return cls( - model=f"T{model_name}", + model=model_name, name=name, group=group, language=language,