1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-23 07:58:09 +00:00
trezor-firmware/tests/persistence_tests/test_safety_checks.py
grdddj b6ce90dc73 feat(tests): support UI testing for persistence tests
Added new global `emulator_core` fixture that supports UI recording.

[no changelog]
2023-04-11 15:15:44 +02:00

38 lines
1.1 KiB
Python

import pytest
from trezorlib import debuglink, device
from trezorlib.messages import SafetyCheckLevel
from ..common import MNEMONIC12
from ..emulators import Emulator
from ..upgrade_tests import core_only
@core_only
@pytest.mark.parametrize(
"set_level,after_level",
[
(SafetyCheckLevel.Strict, SafetyCheckLevel.Strict),
(SafetyCheckLevel.PromptTemporarily, SafetyCheckLevel.Strict),
(SafetyCheckLevel.PromptAlways, SafetyCheckLevel.PromptAlways),
],
)
def test_safety_checks_level_after_reboot(
core_emulator: Emulator, set_level: SafetyCheckLevel, after_level: SafetyCheckLevel
):
device.wipe(core_emulator.client)
debuglink.load_device(
core_emulator.client,
mnemonic=MNEMONIC12,
pin="",
passphrase_protection=False,
label="SAFETYLEVEL",
)
device.apply_settings(core_emulator.client, safety_checks=set_level)
assert core_emulator.client.features.safety_checks == set_level
core_emulator.restart()
assert core_emulator.client.features.safety_checks == after_level