Ejemplo n.º 1
0
 def test_decrypt_fail_binary_as_plain(self):
     self.unencrypted = '\xff'
     self.content_type = 'text/plain'
     with self.assertRaises(em.CryptoAcceptNotSupportedException):
         em.denormalize_after_decryption(self.unencrypted,
                                         self.content_type)
Ejemplo n.º 2
0
 def test_decrypt_text(self):
     self.content_type = 'text/plain'
     unenc = em.denormalize_after_decryption(self.unencrypted,
                                             self.content_type)
     self.assertEqual(self.unencrypted.decode('utf-8'), unenc)
Ejemplo n.º 3
0
 def test_decrypt_fail_unknown_content_type(self):
     self.content_type = 'bogus'
     with self.assertRaises(em.CryptoGeneralException):
         em.denormalize_after_decryption(self.unencrypted,
                                         self.content_type)
Ejemplo n.º 4
0
 def test_decrypt_fail_binary(self):
     unenc = em.denormalize_after_decryption(self.unencrypted,
                                             self.content_type)
     self.assertEqual(self.unencrypted, unenc)
Ejemplo n.º 5
0
 def test_decrypt_fail_binary_as_plain(self):
     self.unencrypted = '\xff'
     self.content_type = 'text/plain'
     with self.assertRaises(em.CryptoAcceptNotSupportedException):
         em.denormalize_after_decryption(self.unencrypted,
                                         self.content_type)
Ejemplo n.º 6
0
 def test_decrypt_fail_unknown_content_type(self):
     self.content_type = 'bogus'
     with self.assertRaises(em.CryptoGeneralException):
         em.denormalize_after_decryption(self.unencrypted,
                                         self.content_type)
Ejemplo n.º 7
0
 def test_decrypt_text(self):
     self.content_type = 'text/plain'
     unenc = em.denormalize_after_decryption(self.unencrypted,
                                             self.content_type)
     self.assertEqual(self.unencrypted.decode('utf-8'), unenc)
Ejemplo n.º 8
0
 def test_decrypt_fail_binary(self):
     unenc = em.denormalize_after_decryption(self.unencrypted,
                                             self.content_type)
     self.assertEqual(self.unencrypted, unenc)