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

chore(tests): using setup_client for setting the passphrase in device tests where applicable

This commit is contained in:
grdddj 2021-09-07 18:17:32 +02:00 committed by matejcik
parent 53e2573691
commit 6b3c9d5a6b
6 changed files with 9 additions and 11 deletions

View File

@ -34,7 +34,7 @@ class TestDebuglink:
mnemonic = client.debug.state().mnemonic_secret
assert mnemonic == MNEMONIC12.encode()
@pytest.mark.setup_client(mnemonic=MNEMONIC12, pin="1234", passphrase=True)
@pytest.mark.setup_client(mnemonic=MNEMONIC12, pin="1234", passphrase="")
def test_pin(self, client):
resp = client.call_raw(messages.GetAddress())
assert isinstance(resp, messages.PinMatrixRequest)

View File

@ -65,7 +65,7 @@ def test_2of3_dryrun(client):
)
@pytest.mark.setup_client(mnemonic=MNEMONIC_SLIP39_ADVANCED_20, passphrase=True)
@pytest.mark.setup_client(mnemonic=MNEMONIC_SLIP39_ADVANCED_20)
def test_2of3_invalid_seed_dryrun(client):
debug = client.debug

View File

@ -35,7 +35,7 @@ INVALID_SHARES_20_2of3 = [
]
@pytest.mark.setup_client(mnemonic=SHARES_20_2of3[0:2], passphrase=True)
@pytest.mark.setup_client(mnemonic=SHARES_20_2of3[0:2])
def test_2of3_dryrun(client):
debug = client.debug
@ -62,7 +62,7 @@ def test_2of3_dryrun(client):
)
@pytest.mark.setup_client(mnemonic=SHARES_20_2of3[0:2], passphrase=True)
@pytest.mark.setup_client(mnemonic=SHARES_20_2of3[0:2])
def test_2of3_invalid_seed_dryrun(client):
debug = client.debug

View File

@ -19,7 +19,7 @@ import pytest
from ..common import MNEMONIC_SLIP39_BASIC_20_3of6, get_test_address
@pytest.mark.setup_client(mnemonic=MNEMONIC_SLIP39_BASIC_20_3of6, passphrase=True)
@pytest.mark.setup_client(mnemonic=MNEMONIC_SLIP39_BASIC_20_3of6, passphrase="TREZOR")
@pytest.mark.skip_t1
def test_3of6_passphrase(client):
"""
@ -28,7 +28,6 @@ def test_3of6_passphrase(client):
xprv9s21ZrQH143K2pMWi8jrTawHaj16uKk4CSbvo4Zt61tcrmuUDMx2o1Byzcr3saXNGNvHP8zZgXVdJHsXVdzYFPavxvCyaGyGr1WkAYG83ce
"""
assert client.features.passphrase_protection is True
client.use_passphrase("TREZOR")
address = get_test_address(client)
assert address == "mi4HXfRJAqCDyEdet5veunBvXLTKSxpuim"
@ -38,7 +37,7 @@ def test_3of6_passphrase(client):
"hobo romp academic axis august founder knife legal recover alien expect emphasis loan kitchen involve teacher capture rebuild trial numb spider forward ladle lying voter typical security quantity hawk legs idle leaves gasoline",
"hobo romp academic agency ancestor industry argue sister scene midst graduate profile numb paid headset airport daisy flame express scene usual welcome quick silent downtown oral critical step remove says rhythm venture aunt",
),
passphrase=True,
passphrase="TREZOR",
)
@pytest.mark.skip_t1
def test_2of5_passphrase(client):
@ -48,6 +47,5 @@ def test_2of5_passphrase(client):
xprv9s21ZrQH143K2o6EXEHpVy8TCYoMmkBnDCCESLdR2ieKwmcNG48ck2XJQY4waS7RUQcXqR9N7HnQbUVEDMWYyREdF1idQqxFHuCfK7fqFni
"""
assert client.features.passphrase_protection is True
client.use_passphrase("TREZOR")
address = get_test_address(client)
assert address == "mjXH4pN7TtbHp3tWLqVKktKuaQeByHMoBZ"

View File

@ -29,7 +29,7 @@ XPUB = "xpub6BiVtCpG9fQPxnPmHXG8PhtzQdWC2Su4qWu6XW9tpWFYhxydCLJGrWBJZ5H6qTAHdPQ7
PIN4 = "1234"
@pytest.mark.setup_client(pin=PIN4, passphrase=True)
@pytest.mark.setup_client(pin=PIN4, passphrase="")
def test_clear_session(client):
is_trezor1 = client.features.model == "1"
init_responses = [

View File

@ -308,7 +308,7 @@ def test_passphrase_always_on_device(client):
@pytest.mark.skip_t2
@pytest.mark.setup_client(passphrase=True)
@pytest.mark.setup_client(passphrase="")
def test_passphrase_on_device_not_possible_on_t1(client):
# This setting makes no sense on T1.
response = client.call_raw(messages.ApplySettings(passphrase_always_on_device=True))
@ -332,7 +332,7 @@ def test_passphrase_ack_mismatch(client):
assert response.code == FailureType.DataError
@pytest.mark.setup_client(passphrase=True)
@pytest.mark.setup_client(passphrase="")
def test_passphrase_missing(client):
response = client.call_raw(XPUB_REQUEST)
assert isinstance(response, messages.PassphraseRequest)