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)
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)
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)
def test_decrypt_fail_binary(self): unenc = em.denormalize_after_decryption(self.unencrypted, self.content_type) self.assertEqual(self.unencrypted, unenc)