1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00

tests: enable load_device test for core

This commit is contained in:
Tomas Susanka 2019-09-02 13:55:16 +02:00
parent 7c74f1c54c
commit 798ee4a83f

View File

@ -17,14 +17,16 @@
import pytest
from trezorlib import btc, debuglink, device
from trezorlib.messages.PassphraseSourceType import HOST as PASSPHRASE_ON_HOST
from .common import MNEMONIC12, TrezorTest
@pytest.mark.skip_t2
@pytest.mark.setup_client(uninitialized=True)
class TestDeviceLoad(TrezorTest):
def test_load_device_1(self, client):
if client.features.model == "2":
device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST)
debuglink.load_device_by_mnemonic(
client,
mnemonic=MNEMONIC12,
@ -41,6 +43,8 @@ class TestDeviceLoad(TrezorTest):
assert address == "1EfKbQupktEMXf4gujJ9kCFo83k1iMqwqK"
def test_load_device_2(self, client):
if client.features.model == "2":
device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST)
debuglink.load_device_by_mnemonic(
client,
mnemonic=MNEMONIC12,
@ -51,7 +55,10 @@ class TestDeviceLoad(TrezorTest):
client.set_passphrase("passphrase")
state = client.debug.state()
assert state.mnemonic_secret == MNEMONIC12.encode()
assert state.pin == "1234"
if client.features.model == "1":
# we do not send PIN in DebugLinkState in Core
assert state.pin == "1234"
assert state.passphrase_protection is True
address = btc.get_address(client, "Bitcoin", [])
@ -77,6 +84,8 @@ class TestDeviceLoad(TrezorTest):
)
device.wipe(client)
if client.features.model == "2":
device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST)
debuglink.load_device_by_mnemonic(
client,
mnemonic=words_nfkd,
@ -90,6 +99,8 @@ class TestDeviceLoad(TrezorTest):
address_nfkd = btc.get_address(client, "Bitcoin", [])
device.wipe(client)
if client.features.model == "2":
device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST)
debuglink.load_device_by_mnemonic(
client,
mnemonic=words_nfc,
@ -103,6 +114,8 @@ class TestDeviceLoad(TrezorTest):
address_nfc = btc.get_address(client, "Bitcoin", [])
device.wipe(client)
if client.features.model == "2":
device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST)
debuglink.load_device_by_mnemonic(
client,
mnemonic=words_nfkc,
@ -116,6 +129,8 @@ class TestDeviceLoad(TrezorTest):
address_nfkc = btc.get_address(client, "Bitcoin", [])
device.wipe(client)
if client.features.model == "2":
device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST)
debuglink.load_device_by_mnemonic(
client,
mnemonic=words_nfd,