def rand_shares(self, secret, maxshares): numshares = random.randrange(3, maxshares) threshold = random.randrange(2, numshares) shares = PySSSS.splitsecret(secret, threshold, numshares) return (shares, threshold)
def test_bad_threshold(self): with self.assertRaises(ValueError): PySSSS.splitsecret(_secret, _numshares, _threshold)
def test_not_a_share(self): with self.assertRaises(ValueError): PySSSS.splitsecret(_secret, 1, 1)
def test_splitsecret(self, RangeMock): RangeMock.side_effect = self.seq_random shares = PySSSS.splitsecret(_secret, _threshold, _numshares) self.assertEqual(shares, _goodsplit) self.assertNotEqual(shares, _badsplit)