1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00

core/tests/slip39: Add tests for invalid threshold.

This commit is contained in:
Andrew Kozlik 2019-05-03 16:09:40 +02:00
parent 0248671438
commit ff594753e0

View File

@ -77,6 +77,18 @@ class TestCryptoSlip39(unittest.TestCase):
with self.assertRaises(ValueError): with self.assertRaises(ValueError):
slip39.generate_mnemonics(3, [(3, 5), (2, 5)], self.MS) slip39.generate_mnemonics(3, [(3, 5), (2, 5)], self.MS)
# Invalid group threshold.
with self.assertRaises(ValueError):
slip39.generate_mnemonics(0, [(3, 5), (2, 5)], self.MS)
# Member threshold exceeds number of members.
with self.assertRaises(ValueError):
slip39.generate_mnemonics(2, [(3, 2), (2, 5)], self.MS)
# Invalid member threshold.
with self.assertRaises(ValueError):
slip39.generate_mnemonics(2, [(0, 2), (2, 5)], self.MS)
# Group with multiple members and threshold 1. # Group with multiple members and threshold 1.
with self.assertRaises(ValueError): with self.assertRaises(ValueError):
slip39.generate_mnemonics(2, [(3, 5), (1, 3), (2, 5)], self.MS) slip39.generate_mnemonics(2, [(3, 5), (1, 3), (2, 5)], self.MS)