summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2012-07-23 01:53:54 (GMT)
committerR David Murray <rdmurray@bitdance.com>2012-07-23 01:53:54 (GMT)
commit970bef295d390c5ceaedca0f095590cd381a3331 (patch)
treeedcfaa0260becf3c1704f2fe17ea46d8957be0e2 /Lib/test
parent4fb6b0a104ebc2a94638100d013b1d2e917373ba (diff)
parent6a31bc6d81f42ac39868ced08d83cad880a7cce6 (diff)
downloadcpython-970bef295d390c5ceaedca0f095590cd381a3331.zip
cpython-970bef295d390c5ceaedca0f095590cd381a3331.tar.gz
cpython-970bef295d390c5ceaedca0f095590cd381a3331.tar.bz2
Merge #15232: correctly mangle From lines in MIME preamble and epilogue
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_email/test_email.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py
index 003df96..1c3775f 100644
--- a/Lib/test/test_email/test_email.py
+++ b/Lib/test/test_email/test_email.py
@@ -1283,6 +1283,28 @@ From the desk of A.A.A.:
Blah blah blah
""")
+ def test_mangle_from_in_preamble_and_epilog(self):
+ s = StringIO()
+ g = Generator(s, mangle_from_=True)
+ msg = email.message_from_string(textwrap.dedent("""\
+ From: foo@bar.com
+ Mime-Version: 1.0
+ Content-Type: multipart/mixed; boundary=XXX
+
+ From somewhere unknown
+
+ --XXX
+ Content-Type: text/plain
+
+ foo
+
+ --XXX--
+
+ From somewhere unknowable
+ """))
+ g.flatten(msg)
+ self.assertEqual(len([1 for x in s.getvalue().split('\n')
+ if x.startswith('>From ')]), 2)
# Test the basic MIMEAudio class