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
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)
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
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)
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)
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)), [])
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'])