From: W. Trevor King Date: Sun, 21 Oct 2012 19:37:31 +0000 (-0400) Subject: pgp: use always_trust for encrypting to pgp-mime-text in doctest. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=df34da58eb715ac9bf2ac6a5071f7ef759f5ff70;p=pgp-mime.git 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. --- 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