From d8e956fc6d1f4f37b3d5b67c763d322997e97216 Mon Sep 17 00:00:00 2001 From: Tomas Susanka Date: Mon, 30 Dec 2019 11:35:56 +0000 Subject: [PATCH] core/recovery: change exceptions types; modifications in tests --- core/src/apps/management/recovery_device/word_validity.py | 2 +- core/tests/test_apps.management.recovery_device.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/apps/management/recovery_device/word_validity.py b/core/src/apps/management/recovery_device/word_validity.py index 01c1c0246..f1d278cd5 100644 --- a/core/src/apps/management/recovery_device/word_validity.py +++ b/core/src/apps/management/recovery_device/word_validity.py @@ -8,7 +8,7 @@ if False: from trezor.messages.ResetDevice import EnumTypeBackupType -class WordValidityResult(BaseException): +class WordValidityResult(Exception): pass diff --git a/core/tests/test_apps.management.recovery_device.py b/core/tests/test_apps.management.recovery_device.py index 22212cf0e..678fc906a 100644 --- a/core/tests/test_apps.management.recovery_device.py +++ b/core/tests/test_apps.management.recovery_device.py @@ -151,10 +151,10 @@ class TestSlip39(unittest.TestCase): check(BackupType.Slip39_Advanced, ["ocean"]) # 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 - self.assertIsNone(check(BackupType.Bip39, ["ocean"])) + check(BackupType.Bip39, ["ocean"]) # 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") @@ -170,6 +170,10 @@ class TestSlip39(unittest.TestCase): with self.assertRaises(IdentifierMismatch): 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 with self.assertRaises(AlreadyAdded): check(BackupType.Slip39_Advanced, ["trash", "smug", "adjust", "ambition"])