Mercurial > p > roundup > code
diff test/test_multipart.py @ 4425:0bb3054274b8
- some formatting
- fix broken regression-test for message/rfc822 in test_multipart -- the
rfc822 message must have its own header -- this is where we have to
look for the subject. This means we have to include a newline before
the Subject in the test-message, otherwise the Subject line is part of
the mime header, not part of the email attachment.
| author | Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net> |
|---|---|
| date | Wed, 06 Oct 2010 14:13:09 +0000 |
| parents | 6b3919328381 |
| children | 6e3e4f24c753 |
line wrap: on
line diff
--- a/test/test_multipart.py Tue Oct 05 14:24:25 2010 +0000 +++ b/test/test_multipart.py Wed Oct 06 14:13:09 2010 +0000 @@ -23,13 +23,25 @@ from roundup.mailgw import Message class TestMessage(Message): + # A note on message/rfc822: The content of such an attachment is an + # email with at least one header line. RFC2046 tells us: """ A + # media type of "message/rfc822" indicates that the body contains an + # encapsulated message, with the syntax of an RFC 822 message. + # However, unlike top-level RFC 822 messages, the restriction that + # each "message/rfc822" body must include a "From", "Date", and at + # least one destination header is removed and replaced with the + # requirement that at least one of "From", "Subject", or "Date" must + # be present.""" + # This means we have to add a newline after the mime-header before + # the subject, otherwise the subject is part of the mime header not + # part of the email header. table = {'multipart/signed': ' boundary="boundary-%(indent)s";\n', 'multipart/mixed': ' boundary="boundary-%(indent)s";\n', 'multipart/alternative': ' boundary="boundary-%(indent)s";\n', 'text/plain': ' name="foo.txt"\nfoo\n', 'application/pgp-signature': ' name="foo.gpg"\nfoo\n', 'application/pdf': ' name="foo.pdf"\nfoo\n', - 'message/rfc822': 'Subject: foo\n\nfoo\n'} + 'message/rfc822': '\nSubject: foo\n\nfoo\n'} def __init__(self, spec): """Create a basic MIME message according to 'spec'. @@ -215,7 +227,7 @@ multipart/mixed message/rfc822""", (None, - [('foo', 'message/rfc822', 'foo\n')])) + [('foo.eml', 'message/rfc822', 'Subject: foo\n\nfoo\n')])) def test_suite(): suite = unittest.TestSuite()
