def test_set_config(self): config_dictionary = ConfigService.read_input(TEST_CONFIG_FILE_PATH) ConfigService.validate_input(config_dictionary) config = ConfigService.set_config(config_dictionary) assert config.WORKING_DIRECTORY == config_dictionary[ ConfigKeys. WORKING_DIRECTORY] or config.WORKING_DIRECTORY == DEFAULT_WORKING_DIRECTORY assert config.FILES == config_dictionary[ ConfigKeys.FILES] or config.FILES == ['*'] assert config.COLUMNS_TO_HASH == config_dictionary[ ConfigKeys. COLUMNS_TO_HASH] or config.COLUMNS_TO_HASH == DEFAULT_COLUMNS_TO_HASH assert config.AUTHENTICATION_CLIENT_ID is not None assert config.AUTHENTICATION_TENANT_AUTHORITY is not None assert config.AUTHENTICATION_SCOPE is not None assert config.START_DATE is not None assert config.END_DATE is not None assert config.COLUMN_TO_SEARCH == config_dictionary[ ConfigKeys.COLUMN_TO_SEARCH] or config.COLUMN_TO_SEARCH is None
def test_validate_input_with_invalid_end_date(self): config = ConfigService.read_input(TEST_CONFIG_FILE_PATH) config[ConfigKeys.START_DATE] = '9-9-99' with pytest.raises(ValueError): ConfigService.validate_input(config)
def test_validate_input_with_invalid_column_item_value(self): config = ConfigService.read_input(TEST_CONFIG_FILE_PATH) config[ConfigKeys.COLUMNS_TO_HASH] = [None] with pytest.raises(ValueError): ConfigService.validate_input(config)
def test_validate_input_with_invalid_file_item_value(self): config = ConfigService.read_input(TEST_CONFIG_FILE_PATH) config[ConfigKeys.FILES] = [TEST_CONFIG_FILE_PATH, 9] with pytest.raises(ValueError): ConfigService.validate_input(config)
def test_validate_input_with_nonexistant_client_id_key(self): config = ConfigService.read_input(TEST_CONFIG_FILE_PATH) del config[ConfigKeys.AUTHENTICATION_CLIENT_ID] with pytest.raises(ValueError): ConfigService.validate_input(config)
def test_validate_input_with_nonexistant_auth_authority_key(self): config = ConfigService.read_input(TEST_CONFIG_FILE_PATH) del config[ConfigKeys.AUTHENTICATION_TENANT_AUTHORITY] with pytest.raises(ValueError): ConfigService.validate_input(config)
def test_validate_input_with_invalid_auth_scope_value(self): config = ConfigService.read_input(TEST_CONFIG_FILE_PATH) config[ConfigKeys.AUTHENTICATION_SCOPE] = 9 with pytest.raises(ValueError): ConfigService.validate_input(config)
def test_validate_input_with_invalid_working_directory_value(self): config = ConfigService.read_input(TEST_CONFIG_FILE_PATH) config[ConfigKeys.WORKING_DIRECTORY] = 0 with pytest.raises(ValueError): ConfigService.validate_input(config)
def test_validate_input_with_invalid_key(self): config = ConfigService.read_input(TEST_CONFIG_FILE_PATH) config['INVALID_KEY'] = True with pytest.raises(ValueError): ConfigService.validate_input(config)