Ejemplo n.º 1
0
 def run_check_config(self, config, expected_ok):
     conf_file_name = os.path.join(self.tmpdir, 'faucet.yaml')
     with open(conf_file_name, 'w') as conf_file:
         conf_file.write(config)
     result_ok, _ = check_faucet_config.check_config( # pylint: disable=unexpected-keyword-arg
         [conf_file_name], debug_level=logging.FATAL)
     return expected_ok == result_ok
Ejemplo n.º 2
0
 def run_check_config(self, config, expected_ok):
     conf_file_name = os.path.join(self.tmpdir, 'faucet.yaml')
     with open(conf_file_name, 'w') as conf_file:
         conf_file.write(config)
     with open(os.devnull, 'w') as check_output_file:
         result_ok = check_config(  # pylint: disable=unexpected-keyword-arg
             [conf_file_name], logging.FATAL, check_output_file)
     return expected_ok == result_ok
Ejemplo n.º 3
0
 def run_check_config(self, config, expected_ok):
     """Try to parse config and return True if result fails or succeeds as expected."""
     conf_file_name = os.path.join(self.tmpdir, 'faucet.yaml')
     with open(conf_file_name, 'w') as conf_file:
         conf_file.write(config)
     with open(os.devnull, 'w') as check_output_file:
         result_ok = check_config( # pylint: disable=unexpected-keyword-arg
             [conf_file_name], logging.FATAL, check_output_file)
     return expected_ok == result_ok
Ejemplo n.º 4
0
 def run_check_config(self, config, expected_ok):
     """Try to parse config and return True if result fails or succeeds as expected."""
     conf_files = []
     if config is not None:
         conf_file_name = os.path.join(self.tmpdir, 'faucet.yaml')
         with open(conf_file_name, 'w') as conf_file:
             conf_file.write(config)
         conf_files = [conf_file_name]
     with open(os.devnull, 'w') as check_output_file:
         result_ok = check_config(  # pylint: disable=unexpected-keyword-arg
             conf_files, logging.FATAL, check_output_file)
     return expected_ok == result_ok
Ejemplo n.º 5
0
    def run_check_config(self, config):
        conf_file = os.path.join(self.tmpdir, 'faucet.yaml')
        with open(conf_file, 'w') as conf:
            conf.write(config)

        return check_config([conf_file])