예제 #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
     )