Ejemplo n.º 1
0
 def test_hyp_output(self, mocker, x):
     mocker.patch('llmnr_sphinx.parse_config_interfaces',
                  return_value=self.config_values['interface'])
     config_vals_local = self.config_values.copy()
     config_vals_local['output'] = 'not_syslog'
     with pytest.raises(ValueError):
         llmnr_sphinx.parse_parameters('\n'.join(
             self.config_contents).format(**config_vals_local))
         pass
     pass
Ejemplo n.º 2
0
 def test_timeout_larger_delay(self, mocker):
     mocker.patch('llmnr_sphinx.parse_config_interfaces',
                  return_value=self.config_values['interface'])
     config_vals_local = self.config_values.copy()
     config_vals_local['timeout'] = 15
     with pytest.raises(ValueError):
         llmnr_sphinx.parse_parameters('\n'.join(
             self.config_contents).format(**config_vals_local))
         pass
     pass
Ejemplo n.º 3
0
 def test_hyp_delay(self, mocker, x):
     mocker.patch('llmnr_sphinx.parse_config_interfaces',
                  return_value=self.config_values['interface'])
     config_vals_local = self.config_values.copy()
     config_vals_local['sending_delay'] = "%s" % (x)
     with pytest.raises(ValueError):
         llmnr_sphinx.parse_parameters('\n'.join(
             self.config_contents).format(**config_vals_local))
         pass
     pass
Ejemplo n.º 4
0
 def test_missing_section(self, mocker):
     mocker.patch('llmnr_sphinx.parse_config_interfaces',
                  return_value=self.config_values['interface'])
     config_vals_local = self.config_values.copy()
     config_contents_local = self.config_contents.copy()
     del (config_contents_local[-2:])
     with pytest.raises(ValueError):
         llmnr_sphinx.parse_parameters(
             '\n'.join(config_contents_local).format(**config_vals_local))
         pass
     pass
Ejemplo n.º 5
0
 def test_hyp_hostname_value(self, mocker, x):
     mocker.patch('llmnr_sphinx.parse_config_interfaces',
                  return_value=self.config_values['interface'])
     config_vals_local = self.config_values.copy()
     config_contents_local = self.config_contents.copy()
     config_vals_local['dc2'] = x
     with pytest.raises(ValueError):
         llmnr_sphinx.parse_parameters(
             '\n'.join(config_contents_local).format(**config_vals_local))
         pass
     pass
Ejemplo n.º 6
0
 def test_incorrect_ip_addr(self, mocker):
     mocker.patch('llmnr_sphinx.parse_config_interfaces',
                  return_value=self.config_values['interface'])
     config_vals_local = self.config_values.copy()
     config_contents_local = self.config_contents.copy()
     config_vals_local['dc2'] = '192.168.1.1,192.168.1.1'
     with pytest.raises(ValueError):
         llmnr_sphinx.parse_parameters(
             '\n'.join(config_contents_local).format(**config_vals_local))
         pass
     pass
Ejemplo n.º 7
0
 def test_multiple_int_types(self, mocker):
     mocker.patch('llmnr_sphinx.parse_config_interfaces',
                  return_value=self.config_values['interface'])
     config_vals_local = self.config_values.copy()
     config_contents_local = self.config_contents.copy()
     config_contents_local.insert(1, "send_interface= {send_interface}")
     with pytest.raises(ValueError):
         llmnr_sphinx.parse_parameters(
             '\n'.join(config_contents_local).format(**config_vals_local))
         pass
     pass
Ejemplo n.º 8
0
 def test_functioning_parser(self, mocker):
     mocker.patch('llmnr_sphinx.parse_config_interfaces',
                  return_value=self.config_values['interface'])
     assert type(
         llmnr_sphinx.parse_parameters('\n'.join(
             self.config_contents).format(**self.config_values))) == type(
                 dict())
     pass
Ejemplo n.º 9
0
 def test_hyp_hostname_key(self, mocker, x):
     mocker.patch('llmnr_sphinx.parse_config_interfaces',
                  return_value=self.config_values['interface'])
     config_vals_local = self.config_values.copy()
     config_contents_local = self.config_contents.copy()
     config_vals_local[x] = None
     assert type(
         llmnr_sphinx.parse_parameters(
             '\n'.join(config_contents_local).format(
                 **config_vals_local))) == type(dict())