mirror of https://github.com/fail2ban/fail2ban
testIPToName: switch from google to one of the root-servers (8.8.4.4 seems not to have rDNS anymore)
parent
3190febb27
commit
6fb89d1709
|
@ -2200,11 +2200,13 @@ class DNSUtilsNetworkTests(unittest.TestCase):
|
|||
|
||||
def testIpToName(self):
|
||||
#unittest.F2B.SkipIfNoNetwork()
|
||||
res = DNSUtils.ipToName('8.8.4.4')
|
||||
self.assertTrue(res.endswith(('.google', '.google.com')))
|
||||
self.assertEqual(DNSUtils.ipToName('87.142.124.10'), 'test-host')
|
||||
self.assertEqual(DNSUtils.ipToName('2001:db8::ffff'), 'test-other')
|
||||
res = DNSUtils.ipToName('199.9.14.201')
|
||||
self.assertTrue(res.endswith(('.isi.edu', '.b.root-servers.org')))
|
||||
# same as above, but with IPAddr:
|
||||
res = DNSUtils.ipToName(IPAddr('8.8.4.4'))
|
||||
self.assertTrue(res.endswith(('.google', '.google.com')))
|
||||
res = DNSUtils.ipToName(IPAddr('199.9.14.201'))
|
||||
self.assertTrue(res.endswith(('.isi.edu', '.b.root-servers.org')))
|
||||
# invalid ip (TEST-NET-1 according to RFC 5737)
|
||||
res = DNSUtils.ipToName('192.0.2.0')
|
||||
self.assertEqual(res, None)
|
||||
|
|
|
@ -311,7 +311,8 @@ def initTests(opts):
|
|||
# precache all ip to dns used in test cases:
|
||||
c.set('192.0.2.888', None)
|
||||
c.set('8.8.4.4', 'dns.google')
|
||||
c.set('8.8.4.4', 'dns.google')
|
||||
c.set('8.8.8.8', 'dns.google')
|
||||
c.set('199.9.14.201', 'b-2017.b.root-servers.org')
|
||||
# precache all dns to ip's used in test cases:
|
||||
c = DNSUtils.CACHE_nameToIp
|
||||
c.clear = lambda: logSys.warning('clear CACHE_nameToIp is disabled in test suite')
|
||||
|
|
Loading…
Reference in New Issue