示例#1
0
 def test_extract_ip_and_bytes_when_input_output_is_scrip(self):
     self.assertEqual(
         network.extract_ip_and_bytes(
             '10.10.10.10 | 20.20.20.20 | 30',
             'scrip',
         ),
         (u'10.10.10.10', 30)
     )
示例#2
0
 def test_extract_ip_and_bytes_when_ip_is_not_in_class_address(self):
     self.assertEqual(
         network.extract_ip_and_bytes(
             '10.10.10.10 | 20.20.20.20 | 30',
             'scrip',
         ),
         None
     )
示例#3
0
 def test_extract_ip_and_bytes_when_bytes_string_is_megabytes_format(self):
     self.assertEqual(
         network.extract_ip_and_bytes(
             '10.10.10.10 | 20.20.20.20 | 1 M',
             'scrip',
         )[1],
         1048576
     )
示例#4
0
 def test_extract_ip_and_bytes_when_bytes_string_is_gigabytes_format(self):
     self.assertEqual(
         network.extract_ip_and_bytes(
             '10.10.10.10 | 20.20.20.20 | 1 G',
             'scrip',
         )[1],
         1073741824
     )
示例#5
0
 def test_extract_ip_and_bytes_when_bytes_string_is_bytes_format(self):
     self.assertEqual(
         network.extract_ip_and_bytes(
             '10.10.10.10 | 20.20.20.20 | 3000',
             'scrip',
         )[1],
         3000
     )