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

fix device tests

[no changelog]
This commit is contained in:
M1nd3r 2025-01-02 17:00:34 +01:00
parent 5334ac5df3
commit f551445c3a
2 changed files with 17 additions and 8 deletions

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
@ -124,6 +125,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
@ -154,19 +156,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.GetFeatures()) 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
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

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