def get_configuration(config_file): try: config = datacollector.check_configuration(config_file) except FileNotFoundError as error: logger.error(error) sys.exit(1) logger.info(f"[*] config: {config}") return config
def test_check_configuration_file_not_exists(): configuration_file_nonsense = 'example.json' with pytest.raises(FileNotFoundError): config = datacollector.check_configuration(configuration_file_nonsense)
def test_check_configuration_parameter_softwatersystem(): item = 'softWaterSystem' config = datacollector.check_configuration(CONFIGURATION_FILE) tmp = config[item] assert isinstance(tmp, dict)
def test_check_configuration_parameter_data_file(): item = 'dataFile' config = datacollector.check_configuration(CONFIGURATION_FILE) tmp = config[item] assert isinstance(tmp, dict)
def test_check_configuration_parameter_data_path(): item = 'dataPath' config = datacollector.check_configuration(CONFIGURATION_FILE) tmp = config[item] assert isinstance(tmp, str)
def test_check_configuration_parameter_not_exists(): item = 'example' config = datacollector.check_configuration(CONFIGURATION_FILE) with pytest.raises(KeyError): tmp = config[item]
def test_check_configuration_file_type(): config = datacollector.check_configuration(CONFIGURATION_FILE) assert isinstance(config, dict)