예제 #1
0
    def test_no_list_address_in_cc(self):
        self._mlist.personalize = Personalization.full
        self._mlist.reply_goes_to_list = ReplyToMunging.explicit_header_only
        self._mlist.reply_to_address = '*****@*****.**'
        self._mlist.first_strip_reply_to = True
        msg = mfs("""\
From: [email protected]
To: [email protected]
Reply-To: [email protected]
Cc: [email protected]
Subject: A subject
X-Mailman-Version: X.Y

More things to say.
""")
        cook_headers.process(self._mlist, msg, {})
        self.assertMultiLineEqual(
            msg.as_string(), """\
From: [email protected]
To: [email protected]
Subject: A subject
X-Mailman-Version: X.Y
Precedence: list
Reply-To: [email protected]
Cc: [email protected]

More things to say.
""")
예제 #2
0
 def test_process_digest(self):
     # MIME digests messages are multiparts.
     make_digest_messages(self._mlist)
     messages = [bag.msg for bag in get_queue_messages('virgin')]
     self.assertEqual(len(messages), 2)
     for msg in messages:
         try:
             cook_headers.process(self._mlist, msg, {})
         except AttributeError as error:
             # LP: #1130696 would raise an AttributeError on .sender
             self.fail(error)
예제 #3
0
 def test_process_digest(self):
     # MIME digests messages are multiparts.
     anne = subscribe(self._mlist, 'Anne')
     anne.preferences.delivery_mode = DeliveryMode.mime_digests
     bart = subscribe(self._mlist, 'Bart')
     bart.preferences.delivery_mode = DeliveryMode.plaintext_digests
     make_digest_messages(self._mlist)
     items = get_queue_messages('virgin', expected_count=2)
     for item in items:
         try:
             cook_headers.process(self._mlist, item.msg, {})
         except AttributeError as error:
             # LP: #1130696 would raise an AttributeError on .sender
             self.fail(error)
예제 #4
0
 def test_process_digest(self):
     # MIME digests messages are multiparts.
     anne = subscribe(self._mlist, 'Anne')
     anne.preferences.delivery_mode = DeliveryMode.mime_digests
     bart = subscribe(self._mlist, 'Bart')
     bart.preferences.delivery_mode = DeliveryMode.plaintext_digests
     make_digest_messages(self._mlist)
     messages = [bag.msg for bag in get_queue_messages('virgin')]
     self.assertEqual(len(messages), 2)
     for msg in messages:
         try:
             cook_headers.process(self._mlist, msg, {})
         except AttributeError as error:
             # LP: #1130696 would raise an AttributeError on .sender
             self.fail(error)
예제 #5
0
    def test_non_ascii_description(self):
        self._mlist.description = 'Some Coffee \u2615'
        self._mlist.reply_goes_to_list = ReplyToMunging.point_to_list
        msg = mfs("""\
From: [email protected]
To: [email protected]
Subject: A subject
X-Mailman-Version: X.Y

More things to say.
""")
        cook_headers.process(self._mlist, msg, {})
        self.assertMultiLineEqual(msg.as_string(), """\
From: [email protected]
To: [email protected]
Subject: A subject
X-Mailman-Version: X.Y
Precedence: list
Reply-To: =?utf-8?b?U29tZSBDb2ZmZWUg4piV?= <*****@*****.**>

More things to say.
""")
예제 #6
0
    def test_truncate_description(self):
        # Existing multiline descriptions get truncated with ellipses.
        self._mlist.description = 'A multiline\ndescription\nalready\nexists'
        self._mlist.reply_goes_to_list = ReplyToMunging.point_to_list
        msg = mfs("""\
From: [email protected]
To: [email protected]
Subject: A subject
X-Mailman-Version: X.Y

More things to say.
""")
        cook_headers.process(self._mlist, msg, {})
        self.assertMultiLineEqual(msg.as_string(), """\
From: [email protected]
To: [email protected]
Subject: A subject
X-Mailman-Version: X.Y
Precedence: list
Reply-To: "A multiline [...]" <*****@*****.**>

More things to say.
""")