當前位置: 首頁>>代碼示例>>Python>>正文


Python Suspect.set_source方法代碼示例

本文整理匯總了Python中fuglu.shared.Suspect.set_source方法的典型用法代碼示例。如果您正苦於以下問題:Python Suspect.set_source方法的具體用法?Python Suspect.set_source怎麽用?Python Suspect.set_source使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fuglu.shared.Suspect的用法示例。


在下文中一共展示了Suspect.set_source方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_localpartblacklist

# 需要導入模塊: from fuglu.shared import Suspect [as 別名]
# 或者: from fuglu.shared.Suspect import set_source [as 別名]
    def test_localpartblacklist(self):
        """test messages from mailer-daemon"""
        from fuglu.shared import Suspect
        import email
        v = Vacation()
        v.ignoresender = u""
        v.awayuser = u'[email protected]'
        v.created = datetime.now()
        v.start = datetime.now()
        v.end = v.start + timedelta(days=2)
        v.subject = u'awaaay'
        v.body = u'cya'
        self.session.add(v)
        self.session.flush()
        self.session.expunge_all()
        self.refreshcache()
        botmsg = """From: [email protected]
Subject: mailinglist membership reminder...
"""

        suspect = Suspect('[email protected]',
                          '[email protected]', '/dev/null')
        suspect.set_tag('nobounce', True)
        suspect.set_source(botmsg)

        candidatevacation = self.candidate.on_vacation(suspect)
        self.assertTrue(
            candidatevacation != None, "Vacation object not found in database")
        self.assertFalse(self.candidate.should_send_vacation_message(
            suspect), "Test Message should NOT generate vacation reply(automated)")
開發者ID:Caomhin,項目名稱:fuglu,代碼行數:32,代碼來源:plugins_vacation_test.py

示例2: test_score

# 需要導入模塊: from fuglu.shared import Suspect [as 別名]
# 或者: from fuglu.shared.Suspect import set_source [as 別名]
    def test_score(self):
        suspect = Suspect("[email protected]", "[email protected]", "/dev/null")
        stream = """Date: Mon, 08 Sep 2008 17:33:54 +0200
To: [email protected]
From: [email protected]
Subject: test scanner

  XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
"""
        suspect.set_source(stream)
        result = self.candidate.examine(suspect)
        if type(result) is tuple:
            result, message = result
        score = int(suspect.get_tag("SAPlugin.spamscore"))
        self.failUnless(score > 999, "GTUBE mails should score ~1000 , we got %s" % score)
        self.failUnless(result == REJECT, "High spam should be rejected")
開發者ID:wbnxvzqbrfagznggre,項目名稱:fuglu,代碼行數:18,代碼來源:plugins_sa_test.py

示例3: _make_dummy_suspect

# 需要導入模塊: from fuglu.shared import Suspect [as 別名]
# 或者: from fuglu.shared.Suspect import set_source [as 別名]
    def _make_dummy_suspect(self, envelope_sender_domain='a.unittests.fuglu.org', header_from_domain='a.unittests.fuglu.org', recipient_domain='b.unittests.fuglu.org', file='/dev/null'):
        s = Suspect('[email protected]%s' %
                    envelope_sender_domain, '[email protected]%s'%recipient_domain, file)

        template="""From: [email protected]%s
Subject: Hello spear phished world!
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----=_MIME_BOUNDARY_000_12140"

------=_MIME_BOUNDARY_000_12140
Content-Type: text/plain

blablabla

some <tagged>text</tagged>
------=_MIME_BOUNDARY_000_12140--
        """%header_from_domain

        s.set_source(template)
        return s
開發者ID:oasiswork,項目名稱:fuglu,代碼行數:22,代碼來源:plugins_domainauth_test.py


注:本文中的fuglu.shared.Suspect.set_source方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。