本文整理匯總了Python中slimta.relay.smtp.mx.MxSmtpRelay.attempt方法的典型用法代碼示例。如果您正苦於以下問題:Python MxSmtpRelay.attempt方法的具體用法?Python MxSmtpRelay.attempt怎麽用?Python MxSmtpRelay.attempt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類slimta.relay.smtp.mx.MxSmtpRelay
的用法示例。
在下文中一共展示了MxSmtpRelay.attempt方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_attempt_no_answer
# 需要導入模塊: from slimta.relay.smtp.mx import MxSmtpRelay [as 別名]
# 或者: from slimta.relay.smtp.mx.MxSmtpRelay import attempt [as 別名]
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)
示例2: test_attempt_no_answer
# 需要導入模塊: from slimta.relay.smtp.mx import MxSmtpRelay [as 別名]
# 或者: from slimta.relay.smtp.mx.MxSmtpRelay import attempt [as 別名]
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)
示例3: test_attempt_no_records
# 需要導入模塊: from slimta.relay.smtp.mx import MxSmtpRelay [as 別名]
# 或者: from slimta.relay.smtp.mx.MxSmtpRelay import attempt [as 別名]
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)
示例4: test_attempt_no_records
# 需要導入模塊: from slimta.relay.smtp.mx import MxSmtpRelay [as 別名]
# 或者: from slimta.relay.smtp.mx.MxSmtpRelay import attempt [as 別名]
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)
示例5: test_attempt_force_mx
# 需要導入模塊: from slimta.relay.smtp.mx import MxSmtpRelay [as 別名]
# 或者: from slimta.relay.smtp.mx.MxSmtpRelay import attempt [as 別名]
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)
示例6: test_attempt_no_mx
# 需要導入模塊: from slimta.relay.smtp.mx import MxSmtpRelay [as 別名]
# 或者: from slimta.relay.smtp.mx.MxSmtpRelay import attempt [as 別名]
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)
示例7: test_attempt_no_mx
# 需要導入模塊: from slimta.relay.smtp.mx import MxSmtpRelay [as 別名]
# 或者: from slimta.relay.smtp.mx.MxSmtpRelay import attempt [as 別名]
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)
示例8: test_attempt
# 需要導入模塊: from slimta.relay.smtp.mx import MxSmtpRelay [as 別名]
# 或者: from slimta.relay.smtp.mx.MxSmtpRelay import attempt [as 別名]
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)
示例9: test_attempt
# 需要導入模塊: from slimta.relay.smtp.mx import MxSmtpRelay [as 別名]
# 或者: from slimta.relay.smtp.mx.MxSmtpRelay import attempt [as 別名]
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)