當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。