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

pull/1810/head
grdddj 3 years ago committed by matejcik
parent 53e2573691
commit 6b3c9d5a6b

@ -34,7 +34,7 @@ class TestDebuglink:
mnemonic = client.debug.state().mnemonic_secret mnemonic = client.debug.state().mnemonic_secret
assert mnemonic == MNEMONIC12.encode() 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): def test_pin(self, client):
resp = client.call_raw(messages.GetAddress()) resp = client.call_raw(messages.GetAddress())
assert isinstance(resp, messages.PinMatrixRequest) assert isinstance(resp, messages.PinMatrixRequest)

@ -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): def test_2of3_invalid_seed_dryrun(client):
debug = client.debug debug = client.debug

@ -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): def test_2of3_dryrun(client):
debug = client.debug 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): def test_2of3_invalid_seed_dryrun(client):
debug = client.debug debug = client.debug

@ -19,7 +19,7 @@ import pytest
from ..common import MNEMONIC_SLIP39_BASIC_20_3of6, get_test_address 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 @pytest.mark.skip_t1
def test_3of6_passphrase(client): def test_3of6_passphrase(client):
""" """
@ -28,7 +28,6 @@ def test_3of6_passphrase(client):
xprv9s21ZrQH143K2pMWi8jrTawHaj16uKk4CSbvo4Zt61tcrmuUDMx2o1Byzcr3saXNGNvHP8zZgXVdJHsXVdzYFPavxvCyaGyGr1WkAYG83ce xprv9s21ZrQH143K2pMWi8jrTawHaj16uKk4CSbvo4Zt61tcrmuUDMx2o1Byzcr3saXNGNvHP8zZgXVdJHsXVdzYFPavxvCyaGyGr1WkAYG83ce
""" """
assert client.features.passphrase_protection is True assert client.features.passphrase_protection is True
client.use_passphrase("TREZOR")
address = get_test_address(client) address = get_test_address(client)
assert address == "mi4HXfRJAqCDyEdet5veunBvXLTKSxpuim" 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 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", "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 @pytest.mark.skip_t1
def test_2of5_passphrase(client): def test_2of5_passphrase(client):
@ -48,6 +47,5 @@ def test_2of5_passphrase(client):
xprv9s21ZrQH143K2o6EXEHpVy8TCYoMmkBnDCCESLdR2ieKwmcNG48ck2XJQY4waS7RUQcXqR9N7HnQbUVEDMWYyREdF1idQqxFHuCfK7fqFni xprv9s21ZrQH143K2o6EXEHpVy8TCYoMmkBnDCCESLdR2ieKwmcNG48ck2XJQY4waS7RUQcXqR9N7HnQbUVEDMWYyREdF1idQqxFHuCfK7fqFni
""" """
assert client.features.passphrase_protection is True assert client.features.passphrase_protection is True
client.use_passphrase("TREZOR")
address = get_test_address(client) address = get_test_address(client)
assert address == "mjXH4pN7TtbHp3tWLqVKktKuaQeByHMoBZ" assert address == "mjXH4pN7TtbHp3tWLqVKktKuaQeByHMoBZ"

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

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

Loading…
Cancel
Save