From: Brian Wellington Date: Wed, 17 Jun 2020 19:24:01 +0000 (-0700) Subject: Add a basic test of retrieving entropy. X-Git-Tag: v2.0.0rc1~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4dafd1bca84d1b5c12506fbd964aab14b5f33fa;p=thirdparty%2Fdnspython.git Add a basic test of retrieving entropy. --- diff --git a/tests/test_entropy.py b/tests/test_entropy.py index 491303f8..601b733e 100644 --- a/tests/test_entropy.py +++ b/tests/test_entropy.py @@ -14,6 +14,12 @@ class EntropyTestCase(unittest.TestCase): self.assertEqual(pool.random_32(), 4226376065) self.assertEqual(pool.random_between(10, 50), 29) + def test_pool_random(self): + pool = dns.entropy.EntropyPool() + values = {pool.random_32() for n in range(12)} + # Make sure that the results are at least somewhat random. + self.assertGreater(len(values), 8) + def test_functions(self): v = dns.entropy.random_16() self.assertTrue(0 <= v <= 65535)