summaryrefslogtreecommitdiffstats
path: root/Lib/email/test
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-03-08 02:04:06 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-03-08 02:04:06 (GMT)
commit4617e5085a89952a0bc99c086e5de8dc9f0a5676 (patch)
tree0c5339d472b54a79a5adc0ed585eb3eabc52d084 /Lib/email/test
parent16cd888dd9fa4dc2da642a8edb45e708e296a086 (diff)
downloadcpython-4617e5085a89952a0bc99c086e5de8dc9f0a5676.zip
cpython-4617e5085a89952a0bc99c086e5de8dc9f0a5676.tar.gz
cpython-4617e5085a89952a0bc99c086e5de8dc9f0a5676.tar.bz2
Issue #7143: get_payload used to strip any trailing newline from a
base64 transfer-encoded payload *after* decoding it; it no longer does. email had a special method in utils, _bdecode, specifically to do this, so it must have served a purpose at some point, yet it is clearly wrong per RFC. Fixed with Barry's approval, but no backport. Email package minor version number is bumped, now version 4.0.1. Patch by Joaquin Cuenca Abela.
Diffstat (limited to 'Lib/email/test')
-rw-r--r--Lib/email/test/data/msg_10.txt7
-rw-r--r--Lib/email/test/test_email.py6
-rw-r--r--Lib/email/test/test_email_renamed.py6
3 files changed, 17 insertions, 2 deletions
diff --git a/Lib/email/test/data/msg_10.txt b/Lib/email/test/data/msg_10.txt
index bd30d13..0790396 100644
--- a/Lib/email/test/data/msg_10.txt
+++ b/Lib/email/test/data/msg_10.txt
@@ -26,6 +26,13 @@ VGhpcyBpcyBhIEJhc2U2NCBlbmNvZGVkIG1lc3NhZ2Uu
--BOUNDARY
Content-Type: text/plain; charset="iso-8859-1"
+Content-Transfer-Encoding: Base64
+
+VGhpcyBpcyBhIEJhc2U2NCBlbmNvZGVkIG1lc3NhZ2UuCg==
+
+
+--BOUNDARY
+Content-Type: text/plain; charset="iso-8859-1"
This has no Content-Transfer-Encoding: header.
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
index aa16ce2..36b308f 100644
--- a/Lib/email/test/test_email.py
+++ b/Lib/email/test/test_email.py
@@ -205,8 +205,12 @@ class TestMessageAPI(TestEmailBase):
# Subpart 3 is base64
eq(msg.get_payload(2).get_payload(decode=True),
'This is a Base64 encoded message.')
- # Subpart 4 has no Content-Transfer-Encoding: header.
+ # Subpart 4 is base64 with a trailing newline, which
+ # used to be stripped (issue 7143).
eq(msg.get_payload(3).get_payload(decode=True),
+ 'This is a Base64 encoded message.\n')
+ # Subpart 5 has no Content-Transfer-Encoding: header.
+ eq(msg.get_payload(4).get_payload(decode=True),
'This has no Content-Transfer-Encoding: header.\n')
def test_get_decoded_uu_payload(self):
diff --git a/Lib/email/test/test_email_renamed.py b/Lib/email/test/test_email_renamed.py
index fc8f30a..976d892 100644
--- a/Lib/email/test/test_email_renamed.py
+++ b/Lib/email/test/test_email_renamed.py
@@ -194,8 +194,12 @@ class TestMessageAPI(TestEmailBase):
# Subpart 3 is base64
eq(msg.get_payload(2).get_payload(decode=True),
'This is a Base64 encoded message.')
- # Subpart 4 has no Content-Transfer-Encoding: header.
+ # Subpart 4 is base64 with a trailing newline, which
+ # used to be stripped (issue 7143).
eq(msg.get_payload(3).get_payload(decode=True),
+ 'This is a Base64 encoded message.\n')
+ # Subpart 5 has no Content-Transfer-Encoding: header.
+ eq(msg.get_payload(4).get_payload(decode=True),
'This has no Content-Transfer-Encoding: header.\n')
def test_get_decoded_uu_payload(self):