Пример #1
0
 def test_decrypt(self):
     from pyramid.renderers import render
     from mootiro_web.crypto import enable_crypto, decrypt
     enable_crypto(self.config, rsa_key=self.rsa_key)
     result_normal = render('json', {'a': 1})
     result_encrypted = render('json.encrypted', {'a': 1})
     result_decrypted = decrypt(result_encrypted, self.rsa_key)
     self.assertEqual(result_normal, result_decrypted)
Пример #2
0
 def test_encrypt_n_decrypt(self):
     from mootiro_web.crypto import encrypt, decrypt
     text = '   This is just a simple test   '
     encrypted = encrypt(text, self.rsa_key)
     decrypted = decrypt(encrypted, self.rsa_key)
     self.assertEqual(decrypted, text)