From ff594753e0b13ed44871637b2836414c7617f682 Mon Sep 17 00:00:00 2001 From: Andrew Kozlik Date: Fri, 3 May 2019 16:09:40 +0200 Subject: [PATCH] core/tests/slip39: Add tests for invalid threshold. --- core/tests/test_trezor.crypto.slip39.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/tests/test_trezor.crypto.slip39.py b/core/tests/test_trezor.crypto.slip39.py index b043cbc165..92a120b2e2 100644 --- a/core/tests/test_trezor.crypto.slip39.py +++ b/core/tests/test_trezor.crypto.slip39.py @@ -77,6 +77,18 @@ class TestCryptoSlip39(unittest.TestCase): with self.assertRaises(ValueError): 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. with self.assertRaises(ValueError): slip39.generate_mnemonics(2, [(3, 5), (1, 3), (2, 5)], self.MS)