Exemplo n.º 1
0
 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')
Exemplo n.º 2
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')
Exemplo n.º 3
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)
Exemplo n.º 4
0
 def testNumbIpGood(self):
     '''check to see that numbip succeeds
     when given a valid IP'''
     self.assertEqual(
         IpUtil.numbip(
             '192.168.2.3'),
         3232236035L)
Exemplo n.º 5
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')
Exemplo n.º 6
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')
Exemplo n.º 7
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)
Exemplo n.º 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)
Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 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)
Exemplo n.º 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')
Exemplo n.º 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)