def test_password_change(self): from synnefo.db import aes_encrypt as aes old_pass = aes.SECRET_ENCRYPTION_KEY old = 'bar' encrypted = aes.encrypt_db_charfield(old) aes.SECRET_ENCRYPTION_KEY = 'foo2' self.assertRaises(aes.CorruptedPassword, aes.decrypt_db_charfield, encrypted) aes.SECRET_ENCRYPTION_KEY = old_pass new = aes.decrypt_db_charfield(encrypted) self.assertEqual(old, new)
def test_encrypt_decrtypt(self): from synnefo.db import aes_encrypt as aes old = 'bar' new = aes.decrypt_db_charfield(aes.encrypt_db_charfield(old)) self.assertEqual(old, new)