Exemplo n.º 1
0
 def test_ptr_lookup(self):
     environ = self.environ.copy()
     environ['REMOTE_ADDR'] = '1.2.3.4'
     resolver.query(IgnoreArg(), 'PTR').AndRaise(DNSException)
     resolver.query(IgnoreArg(), 'PTR').AndReturn(['example.com'])
     self.mox.ReplayAll()
     w = WsgiEdge(None)
     w._ptr_lookup(environ)
     self.assertNotIn('slimta.reverse_address', environ)
     w._ptr_lookup(environ)
     self.assertEqual('example.com', environ['slimta.reverse_address'])
 def test_ptr_lookup(self):
     environ = self.environ.copy()
     environ['REMOTE_ADDR'] = '1.2.3.4'
     resolver.query(IgnoreArg(), 'PTR').AndRaise(DNSException)
     resolver.query(IgnoreArg(), 'PTR').AndReturn(['example.com'])
     self.mox.ReplayAll()
     w = WsgiEdge(None)
     w._ptr_lookup(environ)
     self.assertNotIn('slimta.reverse_address', environ)
     w._ptr_lookup(environ)
     self.assertEqual('example.com', environ['slimta.reverse_address'])
 def test_ptr_lookup(self):
     environ = self.environ.copy()
     environ['REMOTE_ADDR'] = '1.2.3.4'
     self.mox.StubOutWithMock(dns_resolver, 'query')
     dns_resolver.query(IgnoreArg(), 'PTR').AndRaise(DNSException)
     dns_resolver.query(IgnoreArg(), 'PTR').AndReturn(['example.com'])
     self.mox.ReplayAll()
     w = WsgiEdge(None)
     w._ptr_lookup(environ)
     assert_not_in('slimta.reverse_address', environ)
     w._ptr_lookup(environ)
     assert_equal('example.com', environ['slimta.reverse_address'])