|
|
@ -2200,11 +2200,13 @@ class DNSUtilsNetworkTests(unittest.TestCase): |
|
|
|
|
|
|
|
|
|
|
|
def testIpToName(self): |
|
|
|
def testIpToName(self): |
|
|
|
#unittest.F2B.SkipIfNoNetwork() |
|
|
|
#unittest.F2B.SkipIfNoNetwork() |
|
|
|
res = DNSUtils.ipToName('8.8.4.4') |
|
|
|
self.assertEqual(DNSUtils.ipToName('87.142.124.10'), 'test-host') |
|
|
|
self.assertTrue(res.endswith(('.google', '.google.com'))) |
|
|
|
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: |
|
|
|
# same as above, but with IPAddr: |
|
|
|
res = DNSUtils.ipToName(IPAddr('8.8.4.4')) |
|
|
|
res = DNSUtils.ipToName(IPAddr('199.9.14.201')) |
|
|
|
self.assertTrue(res.endswith(('.google', '.google.com'))) |
|
|
|
self.assertTrue(res.endswith(('.isi.edu', '.b.root-servers.org'))) |
|
|
|
# invalid ip (TEST-NET-1 according to RFC 5737) |
|
|
|
# invalid ip (TEST-NET-1 according to RFC 5737) |
|
|
|
res = DNSUtils.ipToName('192.0.2.0') |
|
|
|
res = DNSUtils.ipToName('192.0.2.0') |
|
|
|
self.assertEqual(res, None) |
|
|
|
self.assertEqual(res, None) |
|
|
|