|
|
@ -46,14 +46,24 @@ def test_msg_enc_dec_roundtrip(tmpdir, alice_sec_key_data, bob_pub_key_data): |
|
|
|
# Decrypt message. |
|
|
|
dec_msg, key_list, rating, r = enc_msg.decrypt() |
|
|
|
assert r == 0 |
|
|
|
assert rating == pEp.PEP_rating.PEP_rating_reliable |
|
|
|
# pEp version 2.2 throws this error: |
|
|
|
# AttributeError: module 'pEp' has no attribute 'PEP_rating' |
|
|
|
# assert rating == pEp.PEP_rating.PEP_rating_reliable |
|
|
|
# It seems to have changed to the following. |
|
|
|
assert rating == pEp.native_pEp.rating.reliable |
|
|
|
|
|
|
|
# It is not known which key is generated for Alice, so check only the |
|
|
|
# one for Bob. |
|
|
|
# The first 2 keys are Alice's ones, the last is Bob's one. |
|
|
|
assert key_list[0] == key_list[1] == constants.ALICE_FP |
|
|
|
assert key_list[-1] == constants.BOB_FP |
|
|
|
assert dec_msg.shortmsg == constants.SUBJECT |
|
|
|
assert dec_msg.longmsg.replace("\r", "") == msg.longmsg |
|
|
|
dec_lines = str(dec_msg).replace("\r", "").split("\n") |
|
|
|
# pEp version 2.2 seems to have fixed some of the replaced characters. |
|
|
|
# and changed also: |
|
|
|
# Content-Type: doesn't pring `; charset="utf-8"` anymore. |
|
|
|
# Content-Transfer-Encoding: doesn't print `quoted-printable` anymore. |
|
|
|
# Content-Disposition: is not present anymore. |
|
|
|
# `!` is not replaced by `=21` anymore. |
|
|
|
expected_dec_lines = """From: Alice Lovelace <alice@openpgp.example> |
|
|
|
To: Bob Babagge <bob@openpgp.example> |
|
|
|
Subject: This is a subject |
|
|
@ -62,11 +72,10 @@ X-EncStatus: reliable |
|
|
|
X-KeyList: |
|
|
|
X,X,D1A66E1A23B182C9980F788CFBFCC82A015E7330 |
|
|
|
MIME-Version: 1.0 |
|
|
|
Content-Type: text/plain; charset="utf-8" |
|
|
|
Content-Transfer-Encoding: quoted-printable |
|
|
|
Content-Disposition: inline; filename="msg.txt" |
|
|
|
Content-Type: text/plain |
|
|
|
Content-Transfer-Encoding: 7bit |
|
|
|
|
|
|
|
Hi world=21 |
|
|
|
Hi world! |
|
|
|
""".split("\n") |
|
|
|
assert dec_lines[:5] == expected_dec_lines[:5] |
|
|
|
assert dec_lines[7:] == expected_dec_lines[7:] |
|
|
|