From df34da58eb715ac9bf2ac6a5071f7ef759f5ff70 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 21 Oct 2012 15:37:31 -0400 Subject: [PATCH] pgp: use always_trust for encrypting to pgp-mime-text in doctest. This avoids the abiguously described "General error": S: OK GPGME-Tool 1.3.3-git73b439a ready C: ARMOR true S: OK C: RECIPIENT pgp-mime@invalid.com S: S RECIPIENT B2EDBE0E771A4B8708DD16A7511AEDA64332B6E3 S: OK C: # descriptors in flight: [3] C: INPUT FD S: OK C: # descriptors in flight: [6] C: OUTPUT FD S: OK C: ENCRYPT S: ERR 1 General error C: BYE S: OK closing connection I have spend some time trying to track this one down in gpgme-tool, but without success. --- pgp_mime/pgp.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pgp_mime/pgp.py b/pgp_mime/pgp.py index aefe77c..6bc2d11 100644 --- a/pgp_mime/pgp.py +++ b/pgp_mime/pgp.py @@ -147,7 +147,7 @@ def encrypt(message, recipients=None, **kwargs): >>> from pgp_mime.email import encodedMIMEText >>> message = encodedMIMEText('Hi\nBye') >>> message['To'] = 'pgp-mime-test ' - >>> encrypted = encrypt(message) + >>> encrypted = encrypt(message, always_trust=True) >>> encrypted.set_boundary('boundsep') >>> print(encrypted.as_string()) # doctest: +ELLIPSIS, +REPORT_UDIFF Content-Type: multipart/encrypted; protocol="application/pgp-encrypted"; micalg="pgp-sha1"; boundary="boundsep" @@ -386,7 +386,8 @@ def decrypt(message, **kwargs): >>> from pgp_mime.email import encodedMIMEText >>> message = encodedMIMEText('Hi\nBye') - >>> encrypted = encrypt(message, recipients=['']) + >>> encrypted = encrypt( + ... message, recipients=[''], always_trust=True) >>> decrypted = decrypt(encrypted) >>> print(decrypted.as_string().replace('\r\n', '\n')) ... # doctest: +ELLIPSIS, +REPORT_UDIFF -- 2.26.2