1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-25 07:48:10 +00:00

tests: fix loaddevice test

This commit is contained in:
Tomas Susanka 2019-09-02 14:35:15 +02:00
parent 798ee4a83f
commit 33cc147c66

View File

@ -25,8 +25,6 @@ from .common import MNEMONIC12, TrezorTest
@pytest.mark.setup_client(uninitialized=True) @pytest.mark.setup_client(uninitialized=True)
class TestDeviceLoad(TrezorTest): class TestDeviceLoad(TrezorTest):
def test_load_device_1(self, client): 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( debuglink.load_device_by_mnemonic(
client, client,
mnemonic=MNEMONIC12, mnemonic=MNEMONIC12,
@ -43,8 +41,6 @@ class TestDeviceLoad(TrezorTest):
assert address == "1EfKbQupktEMXf4gujJ9kCFo83k1iMqwqK" assert address == "1EfKbQupktEMXf4gujJ9kCFo83k1iMqwqK"
def test_load_device_2(self, client): 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( debuglink.load_device_by_mnemonic(
client, client,
mnemonic=MNEMONIC12, mnemonic=MNEMONIC12,
@ -52,6 +48,8 @@ class TestDeviceLoad(TrezorTest):
passphrase_protection=True, passphrase_protection=True,
label="test", label="test",
) )
if client.features.model == "T":
device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST)
client.set_passphrase("passphrase") client.set_passphrase("passphrase")
state = client.debug.state() state = client.debug.state()
assert state.mnemonic_secret == MNEMONIC12.encode() assert state.mnemonic_secret == MNEMONIC12.encode()
@ -84,8 +82,6 @@ class TestDeviceLoad(TrezorTest):
) )
device.wipe(client) device.wipe(client)
if client.features.model == "2":
device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST)
debuglink.load_device_by_mnemonic( debuglink.load_device_by_mnemonic(
client, client,
mnemonic=words_nfkd, mnemonic=words_nfkd,
@ -95,12 +91,12 @@ class TestDeviceLoad(TrezorTest):
language="english", language="english",
skip_checksum=True, skip_checksum=True,
) )
if client.features.model == "T":
device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST)
client.set_passphrase(passphrase_nfkd) client.set_passphrase(passphrase_nfkd)
address_nfkd = btc.get_address(client, "Bitcoin", []) address_nfkd = btc.get_address(client, "Bitcoin", [])
device.wipe(client) device.wipe(client)
if client.features.model == "2":
device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST)
debuglink.load_device_by_mnemonic( debuglink.load_device_by_mnemonic(
client, client,
mnemonic=words_nfc, mnemonic=words_nfc,
@ -110,12 +106,12 @@ class TestDeviceLoad(TrezorTest):
language="english", language="english",
skip_checksum=True, skip_checksum=True,
) )
if client.features.model == "T":
device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST)
client.set_passphrase(passphrase_nfc) client.set_passphrase(passphrase_nfc)
address_nfc = btc.get_address(client, "Bitcoin", []) address_nfc = btc.get_address(client, "Bitcoin", [])
device.wipe(client) device.wipe(client)
if client.features.model == "2":
device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST)
debuglink.load_device_by_mnemonic( debuglink.load_device_by_mnemonic(
client, client,
mnemonic=words_nfkc, mnemonic=words_nfkc,
@ -125,12 +121,12 @@ class TestDeviceLoad(TrezorTest):
language="english", language="english",
skip_checksum=True, skip_checksum=True,
) )
if client.features.model == "T":
device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST)
client.set_passphrase(passphrase_nfkc) client.set_passphrase(passphrase_nfkc)
address_nfkc = btc.get_address(client, "Bitcoin", []) address_nfkc = btc.get_address(client, "Bitcoin", [])
device.wipe(client) device.wipe(client)
if client.features.model == "2":
device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST)
debuglink.load_device_by_mnemonic( debuglink.load_device_by_mnemonic(
client, client,
mnemonic=words_nfd, mnemonic=words_nfd,
@ -140,6 +136,8 @@ class TestDeviceLoad(TrezorTest):
language="english", language="english",
skip_checksum=True, skip_checksum=True,
) )
if client.features.model == "T":
device.apply_settings(client, passphrase_source=PASSPHRASE_ON_HOST)
client.set_passphrase(passphrase_nfd) client.set_passphrase(passphrase_nfd)
address_nfd = btc.get_address(client, "Bitcoin", []) address_nfd = btc.get_address(client, "Bitcoin", [])