|
|
|
@ -1383,20 +1383,16 @@ class DNSUtilsNetworkTests(unittest.TestCase):
|
|
|
|
|
self.assertEqual(res, None)
|
|
|
|
|
|
|
|
|
|
def testAddr2bin(self):
|
|
|
|
|
res = DNSUtils.addr2bin('10.0.0.0')
|
|
|
|
|
self.assertEqual(res, 167772160L)
|
|
|
|
|
res = DNSUtils.addr2bin('10.0.0.0', cidr=None)
|
|
|
|
|
self.assertEqual(res, 167772160L)
|
|
|
|
|
res = DNSUtils.addr2bin('10.0.0.0', cidr=32L)
|
|
|
|
|
self.assertEqual(res, 167772160L)
|
|
|
|
|
res = DNSUtils.addr2bin('10.0.0.1', cidr=32L)
|
|
|
|
|
self.assertEqual(res, 167772161L)
|
|
|
|
|
res = DNSUtils.addr2bin('10.0.0.1', cidr=31L)
|
|
|
|
|
self.assertEqual(res, 167772160L)
|
|
|
|
|
|
|
|
|
|
def testBin2addr(self):
|
|
|
|
|
res = DNSUtils.bin2addr(167772160L)
|
|
|
|
|
self.assertEqual(res, '10.0.0.0')
|
|
|
|
|
res = IPAddr('10.0.0.0')
|
|
|
|
|
self.assertEqual(res.addr, 167772160L)
|
|
|
|
|
res = IPAddr('10.0.0.0', cidr=None)
|
|
|
|
|
self.assertEqual(res.addr, 167772160L)
|
|
|
|
|
res = IPAddr('10.0.0.0', cidr=32L)
|
|
|
|
|
self.assertEqual(res.addr, 167772160L)
|
|
|
|
|
res = IPAddr('10.0.0.1', cidr=32L)
|
|
|
|
|
self.assertEqual(res.addr, 167772161L)
|
|
|
|
|
res = IPAddr('10.0.0.1', cidr=31L)
|
|
|
|
|
self.assertEqual(res.addr, 167772160L)
|
|
|
|
|
|
|
|
|
|
def testIPAddr_Equal6(self):
|
|
|
|
|
self.assertEqual(
|
|
|
|
|