def test_encrypt_decrypt(gpg, msg): orig_body = msg.get_payload() msg = gpg.encrypt_email(msg, recipients="*****@*****.**") assert gpgmime.is_encrypted(msg) msg, decrypted = gpg.decrypt_email(msg) assert decrypted # We really ought to check as much of the headers as we can, but it's a bit # tricky to make sure they're textually *identical*. Let's at least check # that the body comes out right: assert msg.get_payload() == orig_body
def test_modify(self, msg): """Verify that modifying a copy doesn't change the original.""" test_subject = 'Unit testing' test_payload = 'This is a test payload' copy = helper.clone_message(msg) copy.replace_header('Subject', test_subject) assert msg['Subject'] != test_subject copy.set_payload(test_payload) assert msg.get_payload() != test_payload
def test_modify(self, msg): """Verify that modifying a copy doesn't change the original.""" test_subject = 'Unit testing' test_payload = 'This is a test payload' copy = helper.clone_message(msg) copy.replace_header('Subject', test_subject) assert msg['Subject'] != test_subject copy.set_payload(test_payload) assert msg.get_payload() != test_payload