コード例 #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)
コード例 #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)
コード例 #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)
コード例 #4
0
 def test_decrypt_fail_binary(self):
     unenc = em.denormalize_after_decryption(self.unencrypted,
                                             self.content_type)
     self.assertEqual(self.unencrypted, unenc)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #8
0
 def test_decrypt_fail_binary(self):
     unenc = em.denormalize_after_decryption(self.unencrypted,
                                             self.content_type)
     self.assertEqual(self.unencrypted, unenc)