1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-24 08:58:46 +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: # Disabling SD protection should fail
@pytest.mark.setup_client(mnemonic=MNEMONIC12) with pytest.raises(TrezorFailure):
def test_sd_protect(self, client): device.sd_protect(client, Op.DISABLE)
# Disabling SD protection should fail # Enable SD protection
with pytest.raises(TrezorFailure): device.sd_protect(client, Op.ENABLE)
device.sd_protect(client, proto.SdProtectOperationType.DISABLE)
# Enable SD protection # Enabling SD protection should fail
device.sd_protect(client, proto.SdProtectOperationType.ENABLE) with pytest.raises(TrezorFailure):
device.sd_protect(client, Op.ENABLE)
# Enabling SD protection should fail
with pytest.raises(TrezorFailure):
device.sd_protect(client, proto.SdProtectOperationType.ENABLE)
# Wipe def test_sd_protect_refresh(client):
device.wipe(client) # Enable SD protection
debuglink.load_device_by_mnemonic( device.sd_protect(client, Op.ENABLE)
client,
mnemonic=MNEMONIC12,
pin="",
passphrase_protection=False,
label="test",
)
# Enable SD protection # Refresh SD protection
device.sd_protect(client, proto.SdProtectOperationType.ENABLE) device.sd_protect(client, Op.REFRESH)
# Refresh SD protection # Disable SD protection
device.sd_protect(client, proto.SdProtectOperationType.REFRESH) device.sd_protect(client, Op.DISABLE)
# Disable SD protection # Refreshing SD protection should fail
device.sd_protect(client, proto.SdProtectOperationType.DISABLE) with pytest.raises(TrezorFailure):
device.sd_protect(client, Op.REFRESH)
# Refreshing SD protection should fail
with pytest.raises(TrezorFailure):
device.sd_protect(client, proto.SdProtectOperationType.REFRESH)