mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-08 15:48:08 +00:00
core/recovery: change exceptions types; modifications in tests
This commit is contained in:
parent
7f730cb6f9
commit
d8e956fc6d
@ -8,7 +8,7 @@ if False:
|
|||||||
from trezor.messages.ResetDevice import EnumTypeBackupType
|
from trezor.messages.ResetDevice import EnumTypeBackupType
|
||||||
|
|
||||||
|
|
||||||
class WordValidityResult(BaseException):
|
class WordValidityResult(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,10 +151,10 @@ class TestSlip39(unittest.TestCase):
|
|||||||
check(BackupType.Slip39_Advanced, ["ocean"])
|
check(BackupType.Slip39_Advanced, ["ocean"])
|
||||||
|
|
||||||
# if backup type is not set we can not do any checks
|
# if backup type is not set we can not do any checks
|
||||||
self.assertIsNone(check(None, ["ocean"]))
|
check(None, ["ocean"])
|
||||||
|
|
||||||
# BIP-39 has no "on-the-fly" checks
|
# BIP-39 has no "on-the-fly" checks
|
||||||
self.assertIsNone(check(BackupType.Bip39, ["ocean"]))
|
check(BackupType.Bip39, ["ocean"])
|
||||||
|
|
||||||
# let's store two shares in the storage
|
# let's store two shares in the storage
|
||||||
secret, share = process_slip39("trash smug adjust ambition criminal prisoner security math cover pecan response pharmacy center criminal salary elbow bracelet lunar briefing dragon")
|
secret, share = process_slip39("trash smug adjust ambition criminal prisoner security math cover pecan response pharmacy center criminal salary elbow bracelet lunar briefing dragon")
|
||||||
@ -170,6 +170,10 @@ class TestSlip39(unittest.TestCase):
|
|||||||
with self.assertRaises(IdentifierMismatch):
|
with self.assertRaises(IdentifierMismatch):
|
||||||
check(BackupType.Slip39_Advanced, ["trash", "slush"])
|
check(BackupType.Slip39_Advanced, ["trash", "slush"])
|
||||||
|
|
||||||
|
# same identifier but different group settings for Slip 39 Basic
|
||||||
|
with self.assertRaises(IdentifierMismatch):
|
||||||
|
check(BackupType.Slip39_Basic, ["trash", "smug", "slush"])
|
||||||
|
|
||||||
# same mnemonic found out using the index
|
# same mnemonic found out using the index
|
||||||
with self.assertRaises(AlreadyAdded):
|
with self.assertRaises(AlreadyAdded):
|
||||||
check(BackupType.Slip39_Advanced, ["trash", "smug", "adjust", "ambition"])
|
check(BackupType.Slip39_Advanced, ["trash", "smug", "adjust", "ambition"])
|
||||||
|
Loading…
Reference in New Issue
Block a user