1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-30 01:58:11 +00:00
trezor-firmware/tests/persistence_tests/test_safety_checks.py

38 lines
1.1 KiB
Python
Raw Normal View History

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