mirror of
https://github.com/SeedSigner/seedsigner.git
synced 2026-10-05 23:18:25 +00:00
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
from seedsigner.models.decode_qr import DecodeQR, DecodeQRStatus
|
|
|
|
|
|
|
|
class TestSettingsQRDecoder:
|
|
def test_decode_settingsqr(self):
|
|
"""
|
|
Assume the QR reader decodes the SettingsQR content correctly and begin this test
|
|
with parsing the result.
|
|
"""
|
|
settings_name = "Test SettingsQR"
|
|
settings_qr_str = f"""settings::v1 name={ settings_name.replace(" ", "_") } persistent=D xpub_qr=urca,sta denom=thr network=M qr_density=M sigs=ss,ms scripts=nat,nes,tr xpub_details=E passphrase=E camera=180 compact_seedqr=E bip85=D priv_warn=E dire_warn=E partners=E"""
|
|
|
|
# Now parse the settings_qr_str
|
|
decoder = DecodeQR()
|
|
status = decoder.add_data(settings_qr_str)
|
|
assert decoder.is_settings
|
|
assert status == DecodeQRStatus.COMPLETE
|
|
|
|
data = decoder.get_settings_data()
|
|
assert data == settings_qr_str
|
|
|
|
|
|
def test_settingsqr_version(self):
|
|
""" Should fail if the "settings" header is missing """
|
|
settings_qr_str = "name=Foo"
|
|
decoder = DecodeQR()
|
|
status = decoder.add_data(settings_qr_str)
|
|
assert status == DecodeQRStatus.INVALID
|