1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-09 15:00:58 +00:00

fix device tests

[no changelog]
This commit is contained in:
M1nd3r 2025-01-02 17:00:34 +01:00
parent 6ba1b40cc9
commit 7d59d23f65
3 changed files with 19 additions and 10 deletions

View File

@ -214,10 +214,10 @@ def test_pubkeys_order(session: Session):
) )
pubkey_internal = btc.get_public_node( pubkey_internal = btc.get_public_node(
client, parse_path("m/45h/0/0/0"), coin_name="Bitcoin" session, parse_path("m/45h/0/0/0"), coin_name="Bitcoin"
).node.public_key ).node.public_key
pubkey_external = btc.get_public_node( pubkey_external = btc.get_public_node(
client, parse_path("m/45h/1/0/0"), coin_name="Bitcoin" session, parse_path("m/45h/1/0/0"), coin_name="Bitcoin"
).node.public_key ).node.public_key
# This assertion implies that script pubkey of multisig_sorted_1, multisig_sorted_2 and multisig_unsorted_1 are the same # This assertion implies that script pubkey of multisig_sorted_1, multisig_sorted_2 and multisig_unsorted_1 are the same

View File

@ -19,6 +19,7 @@ from mnemonic import Mnemonic
from trezorlib import device, messages from trezorlib import device, messages
from trezorlib.btc import get_public_node from trezorlib.btc import get_public_node
from trezorlib.client import ProtocolVersion
from trezorlib.debuglink import LayoutType from trezorlib.debuglink import LayoutType
from trezorlib.debuglink import SessionDebugWrapper as Session from trezorlib.debuglink import SessionDebugWrapper as Session
from trezorlib.exceptions import TrezorFailure from trezorlib.exceptions import TrezorFailure
@ -116,6 +117,7 @@ def test_reset_device_pin(session: Session):
assert resp.passphrase_protection is True assert resp.passphrase_protection is True
@pytest.mark.setup_client(uninitialized=True)
@pytest.mark.uninitialized_session @pytest.mark.uninitialized_session
def test_reset_entropy_check(session: Session): def test_reset_entropy_check(session: Session):
strength = 128 # 12 words strength = 128 # 12 words
@ -143,19 +145,26 @@ def test_reset_entropy_check(session: Session):
assert IF.mnemonic == expected_mnemonic assert IF.mnemonic == expected_mnemonic
# Check that the device is properly initialized. # Check that the device is properly initialized.
resp = session.call_raw(messages.Initialize()) if client.protocol_version is ProtocolVersion.PROTOCOL_V1:
assert resp.initialized is True features = session.call_raw(messages.Initialize())
assert resp.backup_availability == messages.BackupAvailability.NotAvailable else:
assert resp.pin_protection is False session.refresh_features()
assert resp.passphrase_protection is False features = session.features
assert resp.backup_type is messages.BackupType.Bip39 features
assert features.initialized is True
assert features.backup_availability == messages.BackupAvailability.NotAvailable
assert features.pin_protection is False
assert features.passphrase_protection is False
assert features.backup_type is messages.BackupType.Bip39
# Check that the XPUBs are the same as those from the entropy check. # Check that the XPUBs are the same as those from the entropy check.
session = session.client.get_session()
for path, xpub in path_xpubs: for path, xpub in path_xpubs:
res = get_public_node(client, path) res = get_public_node(session, path)
assert res.xpub == xpub assert res.xpub == xpub
@pytest.mark.setup_client(uninitialized=True)
@pytest.mark.uninitialized_session @pytest.mark.uninitialized_session
def test_reset_failed_check(session: Session): def test_reset_failed_check(session: Session):
debug = session.client.debug debug = session.client.debug

View File

@ -116,7 +116,7 @@ def test_reset_entropy_check(session: Session):
# Check that the XPUBs are the same as those from the entropy check. # Check that the XPUBs are the same as those from the entropy check.
for path, xpub in path_xpubs: for path, xpub in path_xpubs:
res = get_public_node(client, path) res = get_public_node(session, path)
assert res.xpub == xpub assert res.xpub == xpub