def test_key_symbols(self): """ Test for correct symbols in key """ reg = r"^[a-zA-Z0-9!\"#$%&'()*+,-./:;<=>?@\[\\\]^_`{|}~]+$" r = re.compile(reg) for i in range(100): secret = generate_secret() result = r.match(secret) try: self.assertIsNotNone(result) except AssertionError as ex: print(reg) print(secret) raise ex
def test_key_generator(self): """ Test correct key generation """ key_len = ord(os.urandom(1)) test_len = len(generate_secret(key_len)) self.assertEqual(key_len, test_len, "Key length test")