Пример #1
0
 def test_format_route_list_value_exception(self):
     expected = ''
     try:
         value = dhcpopts._format_value('route-list',
                     '32.169.254.169.254 ip-adress')
     except ValueError:
         value = ''
     self.assertEqual(expected, value)
Пример #2
0
 def test_format_comma_separated_value(self):
     expected = '0a0a00016578616d706c652e636f6d'
     value = dhcpopts._format_value('ip, string', '10.10.0.1 example.com')
     self.assertEqual(expected, value)
Пример #3
0
 def test_format_none_value(self):
     expected = ''
     value = dhcpopts._format_value('none', 'none')
     self.assertEqual(expected, value)
Пример #4
0
 def test_format_ip_value(self):
     expected = '0a0a0001'
     value = dhcpopts._format_value('ip', '10.10.0.1')
     self.assertEqual(expected, value)
Пример #5
0
 def test_format_string_value(self):
     expected = '6578616d706c652e636f6d2e'
     value = dhcpopts._format_value('string', 'example.com.')
     self.assertEqual(expected, value)
Пример #6
0
 def test_format_int32_value(self):
     expected = '0000012c'
     value = dhcpopts._format_value('int32', 300)
     self.assertEqual(expected, value)
Пример #7
0
 def test_format_bool_value(self):
     expected = '01'
     flag = True
     value = dhcpopts._format_value('bool', flag)
     self.assertEqual(expected, value)
Пример #8
0
 def test_format_route_list_value(self):
     expected = '20a9fea9fe0a0a0002'
     value = dhcpopts._format_value('route-list',
                     '32.169.254.169.254 10.10.0.2')
     self.assertEqual(expected, value)