1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-28 00:58:09 +00:00

test(core): use internal model names

[no changelog]
This commit is contained in:
Martin Milata 2024-03-11 16:20:08 +01:00
parent 73a7223e7b
commit e7f2d3f6cc
102 changed files with 294 additions and 286 deletions

View File

@ -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.

View File

@ -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/

View File

@ -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?

View File

@ -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

View File

@ -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:

View File

@ -30,7 +30,7 @@ if TYPE_CHECKING:
from ..device_handler import BackgroundDeviceHandler
pytestmark = [pytest.mark.skip_t1]
pytestmark = [pytest.mark.skip_t1b1]
@contextmanager

View File

@ -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)

View File

@ -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)

View File

@ -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(

View File

@ -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

View File

@ -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)

View File

@ -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!")

View File

@ -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"
),

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"),

View File

@ -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

View File

@ -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):

View File

@ -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

View File

@ -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
)

View File

@ -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(

View File

@ -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

View File

@ -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:

View File

@ -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")

View File

@ -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.

View File

@ -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).

View File

@ -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),

View File

@ -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(

View File

@ -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)

View File

@ -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

View File

@ -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()]

View File

@ -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(),
]
)

View File

@ -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

View File

@ -32,7 +32,7 @@ from ...input_flows import InputFlowShowXpubQRCode
pytestmark = [
pytest.mark.altcoin,
pytest.mark.cardano,
pytest.mark.skip_t1,
pytest.mark.skip_t1b1,
]

View File

@ -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")

View File

@ -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,
]

View File

@ -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)

View File

@ -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):

View File

@ -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),
]

View File

@ -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],
),
)

View File

@ -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:

View File

@ -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'")

View File

@ -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()

View File

@ -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:

View File

@ -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)])

View File

@ -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),
]

View File

@ -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"))

View File

@ -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))

View File

@ -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),
]

View File

@ -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),
]

View File

@ -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),
]

View File

@ -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),
]

View File

@ -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()

View File

@ -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)

View File

@ -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)

View File

@ -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"

View File

@ -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",

View File

@ -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"

View File

@ -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",

View File

@ -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):

View File

@ -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

View File

@ -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):

View File

@ -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())

View File

@ -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)

View File

@ -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)

View File

@ -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):

View File

@ -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

View File

@ -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):

View File

@ -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/

View File

@ -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
]

View File

@ -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,
]

View File

@ -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,
]

View File

@ -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,
]

View File

@ -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:

View File

@ -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"

View File

@ -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)

View File

@ -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),
]

View File

@ -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

View File

@ -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()

View File

@ -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(

View File

@ -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 = {

View File

@ -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)

View File

@ -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

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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,

View File

@ -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):

View File

@ -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:

View File

@ -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:

View File

@ -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)

View File

@ -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:

View File

@ -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)

View File

@ -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)

View File

@ -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):

View File

@ -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 = [

View File

@ -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)

View File

@ -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,
]

View File

@ -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):

Some files were not shown because too many files have changed in this diff Show More