当前位置: 首页>>代码示例>>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;未经允许,请勿转载。