当前位置: 首页>>代码示例>>Python>>正文


Python mx.MxSmtpRelay类代码示例

本文整理汇总了Python中slimta.relay.smtp.mx.MxSmtpRelay的典型用法代码示例。如果您正苦于以下问题:Python MxSmtpRelay类的具体用法?Python MxSmtpRelay怎么用?Python MxSmtpRelay使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MxSmtpRelay类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_choose_mx

 def test_choose_mx(self):
     records = [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)]
     mx = MxSmtpRelay()
     self.assertEqual(1, mx.choose_mx(records, 0))
     self.assertEqual(5, mx.choose_mx(records, 4))
     self.assertEqual(1, mx.choose_mx(records, 5))
     self.assertEqual(3, mx.choose_mx(records, 7))
     self.assertEqual(2, mx.choose_mx(records, 1821))
开发者ID:RoboticCheese,项目名称:python-slimta,代码行数:8,代码来源:test_slimta_relay_smtp_mx.py

示例2: test_attempt_no_answer

 def test_attempt_no_answer(self):
     env = Envelope("[email protected]", ["[email protected]"])
     mx = MxSmtpRelay()
     self.mox.StubOutWithMock(mx, "new_static_relay")
     self.mox.StubOutWithMock(dns_resolver, "query")
     dns_resolver.query("example.com", "MX").AndRaise(DNSTimeout)
     self.mox.ReplayAll()
     with assert_raises(TransientRelayError):
         mx.attempt(env, 0)
开发者ID:rgcarrasqueira,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_relay_smtp_mx.py

示例3: test_attempt_no_answer

 def test_attempt_no_answer(self):
     env = Envelope('[email protected]', ['[email protected]'])
     mx = MxSmtpRelay()
     self.mox.StubOutWithMock(mx, 'new_static_relay')
     self.mox.StubOutWithMock(dns_resolver, 'query')
     dns_resolver.query('example.com', 'MX').AndRaise(DNSTimeout)
     self.mox.ReplayAll()
     with self.assertRaises(TransientRelayError):
         mx.attempt(env, 0)
开发者ID:sk1p,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_relay_smtp_mx.py

示例4: test_attempt_no_records

 def test_attempt_no_records(self):
     env = Envelope('[email protected]', ['[email protected]'])
     mx = MxSmtpRelay()
     static = self.mox.CreateMock(StaticSmtpRelay)
     self.mox.StubOutWithMock(mx, 'new_static_relay')
     self.mox.StubOutWithMock(dns.resolver, 'query')
     dns.resolver.query('example.com', 'MX').AndRaise(dns.resolver.NXDOMAIN)
     dns.resolver.query('example.com', 'A').AndRaise(dns.resolver.NXDOMAIN)
     self.mox.ReplayAll()
     with self.assertRaises(PermanentRelayError):
         mx.attempt(env, 0)
开发者ID:rafaelnovello,项目名称:python-slimta,代码行数:11,代码来源:test_slimta_relay_smtp_mx.py

示例5: test_attempt_no_records

 def test_attempt_no_records(self):
     env = Envelope("[email protected]", ["[email protected]"])
     mx = MxSmtpRelay()
     static = self.mox.CreateMock(StaticSmtpRelay)
     self.mox.StubOutWithMock(mx, "new_static_relay")
     self.mox.StubOutWithMock(dns_resolver, "query")
     dns_resolver.query("example.com", "MX").AndRaise(dns.resolver.NXDOMAIN)
     dns_resolver.query("example.com", "A").AndRaise(dns.resolver.NXDOMAIN)
     self.mox.ReplayAll()
     with assert_raises(PermanentRelayError):
         mx.attempt(env, 0)
开发者ID:rgcarrasqueira,项目名称:python-slimta,代码行数:11,代码来源:test_slimta_relay_smtp_mx.py

示例6: test_attempt_no_mx

 def test_attempt_no_mx(self):
     env = Envelope('[email protected]', ['[email protected]'])
     a_ret = FakeAAnswer(False, [('1.2.3.4', )])
     mx = MxSmtpRelay()
     static = self.mox.CreateMock(StaticSmtpRelay)
     self.mox.StubOutWithMock(mx, 'new_static_relay')
     self.mox.StubOutWithMock(dns.resolver, 'query')
     dns.resolver.query('example.com', 'MX').AndRaise(dns.resolver.NXDOMAIN)
     dns.resolver.query('example.com', 'A').AndReturn(a_ret)
     mx.new_static_relay('1.2.3.4', 25).AndReturn(static)
     static.attempt(env, 0)
     self.mox.ReplayAll()
     mx.attempt(env, 0)
开发者ID:rafaelnovello,项目名称:python-slimta,代码行数:13,代码来源:test_slimta_relay_smtp_mx.py

示例7: test_attempt_no_mx

 def test_attempt_no_mx(self):
     env = Envelope("[email protected]", ["[email protected]"])
     a_ret = FakeAAnswer(False, [("1.2.3.4",)])
     mx = MxSmtpRelay()
     static = self.mox.CreateMock(StaticSmtpRelay)
     self.mox.StubOutWithMock(mx, "new_static_relay")
     self.mox.StubOutWithMock(dns_resolver, "query")
     dns_resolver.query("example.com", "MX").AndRaise(dns.resolver.NXDOMAIN)
     dns_resolver.query("example.com", "A").AndReturn(a_ret)
     mx.new_static_relay("1.2.3.4", 25).AndReturn(static)
     static.attempt(env, 0)
     self.mox.ReplayAll()
     mx.attempt(env, 0)
开发者ID:rgcarrasqueira,项目名称:python-slimta,代码行数:13,代码来源:test_slimta_relay_smtp_mx.py

示例8: test_attempt_force_mx

 def test_attempt_force_mx(self):
     env = Envelope('[email protected]', ['[email protected]'])
     mx = MxSmtpRelay()
     static = self.mox.CreateMock(StaticSmtpRelay)
     self.mox.StubOutWithMock(mx, 'new_static_relay')
     mx.new_static_relay('mail.example.com', 25).AndReturn(static)
     static.attempt(env, 0)
     static.attempt(env, 1)
     self.mox.ReplayAll()
     mx.force_mx('example.com', 'mail.example.com')
     mx.attempt(env, 0)
     mx.attempt(env, 1)
开发者ID:RoboticCheese,项目名称:python-slimta,代码行数:12,代码来源:test_slimta_relay_smtp_mx.py

示例9: test_attempt

 def test_attempt(self):
     env = Envelope("[email protected]", ["[email protected]"])
     mx_ret = FakeMxAnswer(False, [(5, "mx1.example.com"), (10, "mx2.example.com")])
     mx = MxSmtpRelay()
     static = self.mox.CreateMock(StaticSmtpRelay)
     self.mox.StubOutWithMock(mx, "new_static_relay")
     self.mox.StubOutWithMock(dns_resolver, "query")
     dns_resolver.query("example.com", "MX").AndReturn(mx_ret)
     mx.new_static_relay("mx1.example.com", 25).AndReturn(static)
     static.attempt(env, 0)
     mx.new_static_relay("mx2.example.com", 25).AndReturn(static)
     static.attempt(env, 1)
     self.mox.ReplayAll()
     mx.attempt(env, 0)
     mx.attempt(env, 1)
开发者ID:rgcarrasqueira,项目名称:python-slimta,代码行数:15,代码来源:test_slimta_relay_smtp_mx.py

示例10: test_attempt

 def test_attempt(self):
     env = Envelope('[email protected]', ['[email protected]'])
     mx_ret = FakeMxAnswer(False, [(5, 'mx1.example.com'),
                                   (10, 'mx2.example.com')])
     mx = MxSmtpRelay()
     static = self.mox.CreateMock(StaticSmtpRelay)
     self.mox.StubOutWithMock(mx, 'new_static_relay')
     self.mox.StubOutWithMock(dns.resolver, 'query')
     dns.resolver.query('example.com', 'MX').AndReturn(mx_ret)
     mx.new_static_relay('mx1.example.com', 25).AndReturn(static)
     static.attempt(env, 0)
     mx.new_static_relay('mx2.example.com', 25).AndReturn(static)
     static.attempt(env, 1)
     self.mox.ReplayAll()
     mx.attempt(env, 0)
     mx.attempt(env, 1)
开发者ID:RoboticCheese,项目名称:python-slimta,代码行数:16,代码来源:test_slimta_relay_smtp_mx.py

示例11: test_get_rcpt_domain

 def test_get_rcpt_domain(self):
     env = Envelope('[email protected]', ['[email protected]'])
     mx = MxSmtpRelay()
     self.assertEqual('example.com', mx._get_rcpt_domain(env))
开发者ID:RoboticCheese,项目名称:python-slimta,代码行数:4,代码来源:test_slimta_relay_smtp_mx.py

示例12: test_get_rcpt_domain

 def test_get_rcpt_domain(self):
     env = Envelope("[email protected]", ["[email protected]"])
     mx = MxSmtpRelay()
     assert_equal("example.com", mx._get_rcpt_domain(env))
开发者ID:rgcarrasqueira,项目名称:python-slimta,代码行数:4,代码来源:test_slimta_relay_smtp_mx.py


注:本文中的slimta.relay.smtp.mx.MxSmtpRelay类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。