Exemple #1
0
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
Exemple #2
0
    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
Exemple #3
0
    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