1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-25 01:18:54 +00:00

tests: add sd_card marker and improve sd test

This commit is contained in:
Tomas Susanka 2019-10-16 10:58:56 +02:00
parent 1ca1d77bf7
commit 92e23a2d06
2 changed files with 23 additions and 33 deletions

View File

@ -11,6 +11,7 @@ monero
nem nem
ontology ontology
ripple ripple
sd_card
stellar stellar
tezos tezos
zcash zcash

View File

@ -16,47 +16,36 @@
import pytest import pytest
from trezorlib import debuglink, device, messages as proto from trezorlib import device
from trezorlib.exceptions import TrezorFailure from trezorlib.exceptions import TrezorFailure
from trezorlib.messages import SdProtectOperationType as Op
from ..common import MNEMONIC12 pytestmark = [pytest.mark.skip_t1, pytest.mark.sd_card]
@pytest.mark.skip_t1 def test_sd_protect_enable(client):
class TestMsgSdProtect:
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
def test_sd_protect(self, client):
# Disabling SD protection should fail # Disabling SD protection should fail
with pytest.raises(TrezorFailure): with pytest.raises(TrezorFailure):
device.sd_protect(client, proto.SdProtectOperationType.DISABLE) device.sd_protect(client, Op.DISABLE)
# Enable SD protection # Enable SD protection
device.sd_protect(client, proto.SdProtectOperationType.ENABLE) device.sd_protect(client, Op.ENABLE)
# Enabling SD protection should fail # Enabling SD protection should fail
with pytest.raises(TrezorFailure): with pytest.raises(TrezorFailure):
device.sd_protect(client, proto.SdProtectOperationType.ENABLE) device.sd_protect(client, Op.ENABLE)
# Wipe
device.wipe(client)
debuglink.load_device_by_mnemonic(
client,
mnemonic=MNEMONIC12,
pin="",
passphrase_protection=False,
label="test",
)
def test_sd_protect_refresh(client):
# Enable SD protection # Enable SD protection
device.sd_protect(client, proto.SdProtectOperationType.ENABLE) device.sd_protect(client, Op.ENABLE)
# Refresh SD protection # Refresh SD protection
device.sd_protect(client, proto.SdProtectOperationType.REFRESH) device.sd_protect(client, Op.REFRESH)
# Disable SD protection # Disable SD protection
device.sd_protect(client, proto.SdProtectOperationType.DISABLE) device.sd_protect(client, Op.DISABLE)
# Refreshing SD protection should fail # Refreshing SD protection should fail
with pytest.raises(TrezorFailure): with pytest.raises(TrezorFailure):
device.sd_protect(client, proto.SdProtectOperationType.REFRESH) device.sd_protect(client, Op.REFRESH)