def test_hash_uniqueness(self):
     count = 10000
     api_keys = [auth_utils.generate_api_key() for _ in range(count)]
     hashes = set([hash_utils.hash(api_key) for api_key in api_keys])
     self.assertEqual(len(hashes), count, 'Expected all unique hashes.')
Esempio n. 2
0
 def test_hash_uniqueness(self):
     count = 10000
     api_keys = [auth_utils.generate_api_key() for _ in range(count)]
     hashes = set([hash_utils.hash(api_key) for api_key in api_keys])
     self.assertEqual(len(hashes), count, 'Expected all unique hashes.')
 def test_hash_repeatability(self):
     api_key = auth_utils.generate_api_key()
     hash1 = hash_utils.hash(api_key)
     hash2 = hash_utils.hash(api_key)
     self.assertEqual(hash1, hash2, 'Expected a repeated hash.')
Esempio n. 4
0
 def test_hash_repeatability(self):
     api_key = auth_utils.generate_api_key()
     hash1 = hash_utils.hash(api_key)
     hash2 = hash_utils.hash(api_key)
     self.assertEqual(hash1, hash2, 'Expected a repeated hash.')