def testStripGood(self):
     '''check that the strip function can
     convert a number back into an IP'''
     self.assertEqual(
         IpUtil.strip(
             3232236035L),
         '192.168.2.3')
 def testIp2IdGoodIp(self):
     '''check to see that ipasid will succeed if passed
     a decent IP'''
     self.assertEqual(
         IpUtil.ipasid(
             '192.168.9.8'),
         'ip_192_168_9_8')
 def testCheckGoodIp(self):
     '''check to see that checkip will return 1 for
     a valid IP address'''
     self.assertEqual(
         IpUtil.checkip(
             '192.168.9.5'),
         1)
 def testNumbIpGood(self):
     '''check to see that numbip succeeds
     when given a valid IP'''
     self.assertEqual(
         IpUtil.numbip(
             '192.168.2.3'),
         3232236035L)
 def testId2IpGoodIp(self):
     '''check to see that idasip succeeds when
     passed a valid IP'''
     self.assertEqual(
         IpUtil.idasip(
             '192.168.5.4'),
         '192.168.5.4')
 def testGetNetStr(self):
     '''check to make sure getnetstr works fine,
     which it should if the tests for strip and
     getnet passed'''
     self.assertEqual(
         IpUtil.getnetstr(
             '192.168.17.6',
             '255.255.240.0'),
         '192.168.16.0')
 def testGetNetAllGood(self):
     '''check to make sure that getnet will
     succeed if it is passed a valid ip/subnet
     pair'''
     self.assertEqual(
         IpUtil.getnet(
             '192.168.2.3',
             '255.255.240.0'),
         3232235520L)
Example #8
0
 def testNumbIpGood(self):
     '''check to see that numbip succeeds
     when given a valid IP'''
     self.assertEqual(IpUtil.numbip('192.168.2.3'), 3232236035L)
Example #9
0
 def testId2IpGoodIp(self):
     '''check to see that idasip succeeds when
     passed a valid IP'''
     self.assertEqual(IpUtil.idasip('192.168.5.4'), '192.168.5.4')
Example #10
0
 def testIp2IdGoodIp(self):
     '''check to see that ipasid will succeed if passed
     a decent IP'''
     self.assertEqual(IpUtil.ipasid('192.168.9.8'), 'ip_192_168_9_8')
Example #11
0
 def testCheckGoodIp(self):
     '''check to see that checkip will return 1 for
     a valid IP address'''
     self.assertEqual(IpUtil.checkip('192.168.9.5'), 1)
Example #12
0
 def testGetNetStr(self):
     '''check to make sure getnetstr works fine,
     which it should if the tests for strip and
     getnet passed'''
     self.assertEqual(IpUtil.getnetstr('192.168.17.6', '255.255.240.0'),
                      '192.168.16.0')
Example #13
0
 def testGetNetAllGood(self):
     '''check to make sure that getnet will
     succeed if it is passed a valid ip/subnet
     pair'''
     self.assertEqual(IpUtil.getnet('192.168.2.3', '255.255.240.0'),
                      3232235520L)