A dummy test for randomBytes

This commit is contained in:
Dmitri Bogomolov 2021-12-09 18:44:57 +02:00
parent f3ccc361fc
commit bbede1d449
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -74,6 +74,14 @@ class TestHighlevelcrypto(unittest.TestCase):
self.assertEqual(
highlevelcrypto.double_sha512(b'hello'), sample_double_sha512)
def test_randomBytes(self):
"""Dummy checks for random bytes"""
for n in (8, 32, 64):
data = highlevelcrypto.randomBytes(n)
self.assertEqual(len(data), n)
self.assertNotEqual(len(set(data)), 1)
self.assertNotEqual(data, highlevelcrypto.randomBytes(n))
def test_verify(self):
"""Verify sample signatures and newly generated ones"""
pubkey_hex = hexlify(sample_pubsigningkey)