Пример #1
0
 def _messageWithPostiniHeader(self, header):
     part = Part()
     part.addHeader(u"X-pstn-levels", unicode(header))
     msg = Message(store=self.store)
     # part._addToStore(self.store, msg, None)
     part.associateWithMessage(msg)
     msg.impl = part
     return msg
Пример #2
0
 def test_otherPrecedence(self):
     """
     Test that an email message with some random other precedence header
     value is focused.
     """
     impl = Part()
     impl.addHeader(u'Precedence', u'made up random value')
     self._focusedTest(impl)
Пример #3
0
 def _messageWithPostiniHeader(self, header):
     part = Part()
     part.addHeader(u'X-pstn-levels', unicode(header))
     msg = Message(store=self.store)
     # part._addToStore(self.store, msg, None)
     part.associateWithMessage(msg)
     msg.impl = part
     return msg
Пример #4
0
 def test_otherPrecedence(self):
     """
     Test that an email message with some random other precedence header
     value is focused.
     """
     impl = Part()
     impl.addHeader(u'Precedence', u'made up random value')
     self._focusedTest(impl)
Пример #5
0
    def test_listPrecedence(self):
        """
        Test that an email message with C{list} precedence is not focused.
        """
        impl = Part()
        impl.addHeader(u'Precedence', u'list')
        self._unfocusedTest(impl)

        impl = Part()
        impl.addHeader(u'Precedence', u'LIsT')
        self._unfocusedTest(impl)
Пример #6
0
    def test_bulkPrecedence(self):
        """
        Test that an email message with C{bulk} precedence is not focused.
        """
        impl = Part()
        impl.addHeader(u'Precedence', u'bulk')
        self._unfocusedTest(impl)

        impl = Part()
        impl.addHeader(u'Precedence', u'BuLK')
        self._unfocusedTest(impl)
Пример #7
0
    def test_listPrecedence(self):
        """
        Test that an email message with C{list} precedence is not focused.
        """
        impl = Part()
        impl.addHeader(u'Precedence', u'list')
        self._unfocusedTest(impl)

        impl = Part()
        impl.addHeader(u'Precedence', u'LIsT')
        self._unfocusedTest(impl)
Пример #8
0
    def test_bulkPrecedence(self):
        """
        Test that an email message with C{bulk} precedence is not focused.
        """
        impl = Part()
        impl.addHeader(u'Precedence', u'bulk')
        self._unfocusedTest(impl)

        impl = Part()
        impl.addHeader(u'Precedence', u'BuLK')
        self._unfocusedTest(impl)
Пример #9
0
    def testEZMLMFilter(self):
        """
        Ensure that match_EZMLM doesn't kerplode when presented with a
        header that doesn't parse well.
        """
        part = Part()
        part.addHeader(u'X-Mailman-Version', u"2.1.5")
        part.addHeader(u'List-Post', u"Random bytes")
        part.source = FilePath(self.storepath).child("files").child("x")
        msg = Message.createIncoming(self.store, part,
                                     u'test://test_mailing_list_filter')

        self.mlfp.processItem(msg)
        self.assertEqual(list(self.tagcatalog.tagsOf(msg)), [])
Пример #10
0
    def testEZMLMFilter(self):
        """
        Ensure that match_EZMLM doesn't kerplode when presented with a
        header that doesn't parse well.
        """
        part = Part()
        part.addHeader(u'X-Mailman-Version', u"2.1.5")
        part.addHeader(u'List-Post',
                       u"Random bytes")
        part.source = FilePath(self.storepath).child("files").child("x")
        msg = Message.createIncoming(self.store, part,
                                     u'test://test_mailing_list_filter')

        self.mlfp.processItem(msg)
        self.assertEqual(list(self.tagcatalog.tagsOf(msg)),
                         [])
Пример #11
0
    def testMailingListFilter(self):
        """
        Ensures that mailing list messages are not handled by
        RuleFilteringPowerup but are handled by MailingListFilteringPowerup.
        """

        part = Part()
        part.addHeader(u'X-Mailman-Version', u"2.1.5")
        part.addHeader(u'List-Id',
                       u"Some mailing list <some-list.example.com>")
        part.source = FilePath(self.storepath).child("files").child("x")
        msg = Message.createIncoming(self.store, part,
                                     u'test://test_mailing_list_filter')

        self.rfp.processItem(msg)
        self.assertEqual(list(self.tagcatalog.tagsOf(msg)), [])

        self.mlfp.processItem(msg)
        self.assertEqual(list(self.tagcatalog.tagsOf(msg)),
                         [u'some-list.example.com'])
Пример #12
0
    def testMailingListFilter(self):
        """
        Ensures that mailing list messages are not handled by
        RuleFilteringPowerup but are handled by MailingListFilteringPowerup.
        """

        part = Part()
        part.addHeader(u'X-Mailman-Version', u"2.1.5")
        part.addHeader(u'List-Id',
                       u"Some mailing list <some-list.example.com>")
        part.source = FilePath(self.storepath).child("files").child("x")
        msg = Message.createIncoming(self.store, part,
                                     u'test://test_mailing_list_filter')

        self.rfp.processItem(msg)
        self.assertEqual(list(self.tagcatalog.tagsOf(msg)), [])

        self.mlfp.processItem(msg)
        self.assertEqual(list(self.tagcatalog.tagsOf(msg)),
                         [u'some-list.example.com'])