def test_symmetric(self, data): data = str(data) sk2 = AutoSymKey(key_iv_code=self.key_iv_code) self.assertEqual(data, sk2.decrypt(self.key.encrypt(data))) self.assertEqual(data, sk2.decrypt_hex(self.key.encrypt_hex(data))) self.assertEqual(data, sk2.decrypt_base64(self.key.encrypt_base64(data)))
class TestAutoSymKey(unittest.TestCase): def setUp(self): self.key = AutoSymKey() def test_auto_load(self): self.key.auto_load() self.assertTrue(self.key.cypher_name is None) self.assertTrue(self.key.key_str is None) try: key2 = AutoSymKey('bogus,bogus,bogus') assert False except ValueError: pass
def test_auto_load(self): self.key.auto_load() self.assertTrue(self.key.cypher_name is None) self.assertTrue(self.key.key_str is None) try: key2 = AutoSymKey('bogus,bogus,bogus') assert False except ValueError: pass
def setUp(self): self.key = AutoSymKey()