mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-23 23:08:14 +00:00
tests: Fix device tests for path checks in GetAddress.
This commit is contained in:
parent
abb5ab74e3
commit
b88e57a7c8
@ -18,6 +18,7 @@ import pytest
|
||||
|
||||
from trezorlib import device, messages
|
||||
from trezorlib.debuglink import TrezorClientDebugLink as Client
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ...common import MNEMONIC12
|
||||
|
||||
@ -84,7 +85,7 @@ def test_pin_passphrase(client: Client):
|
||||
assert client.features.passphrase_protection is True
|
||||
|
||||
# Do passphrase-protected action, PassphraseRequest should be raised
|
||||
resp = client.call_raw(messages.GetAddress())
|
||||
resp = client.call_raw(messages.GetAddress(address_n=parse_path("m/44'/0'/0'/0/0")))
|
||||
assert isinstance(resp, messages.PassphraseRequest)
|
||||
client.call_raw(messages.Cancel())
|
||||
|
||||
@ -135,7 +136,7 @@ def test_nopin_nopassphrase(client: Client):
|
||||
assert client.features.passphrase_protection is False
|
||||
|
||||
# Do pin & passphrase-protected action, PassphraseRequest should NOT be raised
|
||||
resp = client.call_raw(messages.GetAddress())
|
||||
resp = client.call_raw(messages.GetAddress(address_n=parse_path("m/44'/0'/0'/0/0")))
|
||||
assert isinstance(resp, messages.Address)
|
||||
|
||||
|
||||
|
@ -19,6 +19,7 @@ from mnemonic import Mnemonic
|
||||
|
||||
from trezorlib import device, messages
|
||||
from trezorlib.debuglink import TrezorClientDebugLink as Client
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ...common import generate_entropy
|
||||
|
||||
@ -87,7 +88,7 @@ def reset_device(client: Client, strength):
|
||||
assert resp.passphrase_protection is False
|
||||
|
||||
# Do pin & passphrase-protected action, PassphraseRequest should NOT be raised
|
||||
resp = client.call_raw(messages.GetAddress())
|
||||
resp = client.call_raw(messages.GetAddress(address_n=parse_path("m/44'/0'/0'/0/0")))
|
||||
assert isinstance(resp, messages.Address)
|
||||
|
||||
|
||||
@ -186,7 +187,7 @@ def test_reset_device_256_pin(client: Client):
|
||||
assert resp.passphrase_protection is True
|
||||
|
||||
# Do passphrase-protected action, PassphraseRequest should be raised
|
||||
resp = client.call_raw(messages.GetAddress())
|
||||
resp = client.call_raw(messages.GetAddress(address_n=parse_path("m/44'/0'/0'/0/0")))
|
||||
assert isinstance(resp, messages.PassphraseRequest)
|
||||
client.call_raw(messages.Cancel())
|
||||
|
||||
|
@ -18,8 +18,9 @@ import time
|
||||
|
||||
import pytest
|
||||
|
||||
from trezorlib import btc
|
||||
from trezorlib import btc, device
|
||||
from trezorlib.debuglink import TrezorClientDebugLink as Client
|
||||
from trezorlib.messages import SafetyCheckLevel
|
||||
from trezorlib.tools import H_
|
||||
|
||||
pytestmark = [
|
||||
@ -29,6 +30,8 @@ pytestmark = [
|
||||
|
||||
|
||||
def test_public_ckd(client: Client):
|
||||
# disable safety checks to access non-standard paths
|
||||
device.apply_settings(client, safety_checks=SafetyCheckLevel.PromptTemporarily)
|
||||
btc.get_address(client, "Bitcoin", []) # to compute root node via BIP39
|
||||
|
||||
for depth in range(8):
|
||||
@ -41,6 +44,8 @@ def test_public_ckd(client: Client):
|
||||
|
||||
|
||||
def test_private_ckd(client: Client):
|
||||
# disable safety checks to access non-standard paths
|
||||
device.apply_settings(client, safety_checks=SafetyCheckLevel.PromptTemporarily)
|
||||
btc.get_address(client, "Bitcoin", []) # to compute root node via BIP39
|
||||
|
||||
for depth in range(8):
|
||||
@ -54,6 +59,9 @@ def test_private_ckd(client: Client):
|
||||
|
||||
|
||||
def test_cache(client: Client):
|
||||
# disable safety checks to access non-standard paths
|
||||
device.apply_settings(client, safety_checks=SafetyCheckLevel.PromptTemporarily)
|
||||
|
||||
start = time.time()
|
||||
for x in range(10):
|
||||
btc.get_address(client, "Bitcoin", [x, 2, 3, 4, 5, 6, 7, 8])
|
||||
|
@ -18,6 +18,7 @@ import pytest
|
||||
|
||||
from trezorlib import debuglink, device, messages, misc
|
||||
from trezorlib.debuglink import TrezorClientDebugLink as Client
|
||||
from trezorlib.tools import parse_path
|
||||
from trezorlib.transport import udp
|
||||
|
||||
from ..common import MNEMONIC12
|
||||
@ -40,7 +41,7 @@ def test_mnemonic(client: Client):
|
||||
@pytest.mark.skip_t2
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12, pin="1234", passphrase="")
|
||||
def test_pin(client: Client):
|
||||
resp = client.call_raw(messages.GetAddress())
|
||||
resp = client.call_raw(messages.GetAddress(address_n=parse_path("m/44'/0'/0'/0/0")))
|
||||
assert isinstance(resp, messages.PinMatrixRequest)
|
||||
|
||||
state = client.debug.state()
|
||||
|
@ -19,6 +19,7 @@ import pytest
|
||||
from trezorlib import device, exceptions, messages
|
||||
from trezorlib.client import MAX_PIN_LENGTH
|
||||
from trezorlib.debuglink import TrezorClientDebugLink as Client
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
PinType = messages.PinMatrixRequestType
|
||||
|
||||
@ -177,7 +178,7 @@ def test_set_pin_to_wipe_code(client: Client):
|
||||
# Check that there is no PIN protection.
|
||||
client.init_device()
|
||||
assert client.features.pin_protection is False
|
||||
resp = client.call_raw(messages.GetAddress())
|
||||
resp = client.call_raw(messages.GetAddress(address_n=parse_path("m/44'/0'/0'/0/0")))
|
||||
assert isinstance(resp, messages.Address)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user