mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 04:18:10 +00:00
tests: added shamir invalid seed dryrun test (#371)
tests: added shamir invalid seed dryrun test
This commit is contained in:
commit
50a240dbc0
@ -2,7 +2,10 @@ import time
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from trezorlib import debuglink, device, messages
|
from trezorlib import device, messages
|
||||||
|
from trezorlib.exceptions import TrezorFailure
|
||||||
|
|
||||||
|
from .conftest import setup_client
|
||||||
|
|
||||||
pytestmark = pytest.mark.skip_t1
|
pytestmark = pytest.mark.skip_t1
|
||||||
|
|
||||||
@ -12,20 +15,16 @@ SHARES_20_2of3 = [
|
|||||||
"crush merchant academic always course verdict rescue paces fridge museum energy solution space ladybug junction national biology game fawn coal",
|
"crush merchant academic always course verdict rescue paces fridge museum energy solution space ladybug junction national biology game fawn coal",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
INVALID_SHARES_20_2of3 = [
|
||||||
|
"gesture necklace academic acid civil round fiber buyer swing ancient jerky kitchen chest dining enjoy tension museum increase various rebuild",
|
||||||
|
"gesture necklace academic agency decrease justice ounce dragon shaped unknown material answer dress wrote smell family squeeze diet angry husband",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@setup_client(mnemonic=SHARES_20_2of3[0:2], passphrase=True)
|
||||||
def test_2of3_dryrun(client):
|
def test_2of3_dryrun(client):
|
||||||
debug = client.debug
|
debug = client.debug
|
||||||
|
|
||||||
debuglink.load_device_by_mnemonic(
|
|
||||||
client,
|
|
||||||
mnemonic=SHARES_20_2of3[0:2],
|
|
||||||
pin="",
|
|
||||||
passphrase_protection=True,
|
|
||||||
label="test",
|
|
||||||
language="english",
|
|
||||||
skip_checksum=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
def input_flow():
|
def input_flow():
|
||||||
yield # Confirm Dryrun
|
yield # Confirm Dryrun
|
||||||
debug.press_yes()
|
debug.press_yes()
|
||||||
@ -50,6 +49,32 @@ def test_2of3_dryrun(client):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@setup_client(mnemonic=SHARES_20_2of3[0:2], passphrase=True)
|
||||||
|
def test_2of3_invalid_seed_dryrun(client):
|
||||||
|
debug = client.debug
|
||||||
|
|
||||||
|
def input_flow():
|
||||||
|
yield # Confirm Dryrun
|
||||||
|
debug.press_yes()
|
||||||
|
# run recovery flow
|
||||||
|
yield from enter_all_shares(debug, INVALID_SHARES_20_2of3)
|
||||||
|
|
||||||
|
# test fails because of different seed on device
|
||||||
|
with client, pytest.raises(
|
||||||
|
TrezorFailure, match=r"The seed does not match the one in the device"
|
||||||
|
):
|
||||||
|
client.set_input_flow(input_flow)
|
||||||
|
device.recover(
|
||||||
|
client,
|
||||||
|
passphrase_protection=False,
|
||||||
|
pin_protection=False,
|
||||||
|
label="label",
|
||||||
|
language="english",
|
||||||
|
dry_run=True,
|
||||||
|
type=messages.ResetDeviceBackupType.Slip39_Single_Group,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def enter_all_shares(debug, shares):
|
def enter_all_shares(debug, shares):
|
||||||
word_count = len(shares[0].split(" "))
|
word_count = len(shares[0].split(" "))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user