mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
#15232: correctly mangle From lines in MIME preamble and epilogue
This commit is contained in:
parent
e60e12b57a
commit
6a31bc6d81
3 changed files with 35 additions and 2 deletions
|
|
@ -1275,6 +1275,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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue