Skip to content

Commit

Permalink
add CompactSeedQR tests
Browse files Browse the repository at this point in the history
  • Loading branch information
odudex committed Oct 21, 2024
1 parent 4f45414 commit 8d980fc
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions tests/pages/test_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,17 +345,30 @@ def test_load_12w_camera_qrcode_binary(m5stickv, mocker, mocker_printer):
[BUTTON_ENTER]
)
QR_FORMAT = FORMAT_NONE
MNEMONIC = "forum undo fragile fade shy sign arrest garment culture tube off merit"
BINARY_MNEMONIC = b"[\xbd\x9dq\xa8\xecy\x90\x83\x1a\xff5\x9dBeE"
C_SEED_QRs = [
(
b"[\xbd\x9dq\xa8\xecy\x90\x83\x1a\xff5\x9dBeE",
"forum undo fragile fade shy sign arrest garment culture tube off merit",
),
(
b"[\xbd\x9dq\xa8\xecy\x90\x83\x1a\xff5\x9dBeE".decode("latin1"),
"forum undo fragile fade shy sign arrest garment culture tube off merit",
),
(
b"[\xbd\x9dq\xa8\xec \x90\x83\x1a\xff5\x9dBeE".decode("latin1"),
"forum undo fragile fade search embark arrest garment culture tube off melt",
),
]

ctx = create_ctx(mocker, BTN_SEQUENCE)
login = Login(ctx)
mocker.patch.object(
QRCodeCapture, "qr_capture_loop", new=lambda self: (BINARY_MNEMONIC, QR_FORMAT)
)
login.load_key_from_qr_code()
for c_seed_qr in C_SEED_QRs:
ctx = create_ctx(mocker, BTN_SEQUENCE)
login = Login(ctx)
mocker.patch.object(
QRCodeCapture, "qr_capture_loop", new=lambda self: (c_seed_qr[0], QR_FORMAT)
)
login.load_key_from_qr_code()

assert ctx.wallet.key.mnemonic == MNEMONIC
assert ctx.wallet.key.mnemonic == c_seed_qr[1]


def test_load_24w_camera_qrcode_words(m5stickv, mocker, mocker_printer):
Expand Down

0 comments on commit 8d980fc

Please sign in to comment.