mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-04 22:02:34 +00:00
tests: enable load_device test for core
This commit is contained in:
parent
7c74f1c54c
commit
798ee4a83f
@ -17,14 +17,16 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from trezorlib import btc, debuglink, device
|
from trezorlib import btc, debuglink, device
|
||||||
|
from trezorlib.messages.PassphraseSourceType import HOST as PASSPHRASE_ON_HOST
|
||||||
|
|
||||||
from .common import MNEMONIC12, TrezorTest
|
from .common import MNEMONIC12, TrezorTest
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip_t2
|
|
||||||
@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,
|
||||||
@ -41,6 +43,8 @@ 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,
|
||||||
@ -51,7 +55,10 @@ class TestDeviceLoad(TrezorTest):
|
|||||||
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()
|
||||||
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
|
assert state.passphrase_protection is True
|
||||||
|
|
||||||
address = btc.get_address(client, "Bitcoin", [])
|
address = btc.get_address(client, "Bitcoin", [])
|
||||||
@ -77,6 +84,8 @@ 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,
|
||||||
@ -90,6 +99,8 @@ class TestDeviceLoad(TrezorTest):
|
|||||||
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,
|
||||||
@ -103,6 +114,8 @@ class TestDeviceLoad(TrezorTest):
|
|||||||
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,
|
||||||
@ -116,6 +129,8 @@ class TestDeviceLoad(TrezorTest):
|
|||||||
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,
|
||||||
|
Loading…
Reference in New Issue
Block a user