diff options
| author | Brian Wellington <bwelling@xbill.org> | 2020-06-17 12:24:01 -0700 |
|---|---|---|
| committer | Brian Wellington <bwelling@xbill.org> | 2020-06-17 12:24:01 -0700 |
| commit | d4dafd1bca84d1b5c12506fbd964aab14b5f33fa (patch) | |
| tree | bc20c13cc96ce7b160749924d892bc53fc7c9c33 /tests/test_entropy.py | |
| parent | 2b8717d0712955c6074eeda8a302af34760d52e6 (diff) | |
| download | dnspython-d4dafd1bca84d1b5c12506fbd964aab14b5f33fa.tar.gz | |
Add a basic test of retrieving entropy.
Diffstat (limited to 'tests/test_entropy.py')
| -rw-r--r-- | tests/test_entropy.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test_entropy.py b/tests/test_entropy.py index 491303f..601b733 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) |
