diff --git a/chasten/main.py b/chasten/main.py index ec5b43da..8f9b5962 100644 --- a/chasten/main.py +++ b/chasten/main.py @@ -96,7 +96,7 @@ def validate_file( configuration_file_str: str, configuration_file_yml: str, yml_data_dict: Dict[str, Dict[str, Any]], - json_schema: Dict[str, Dict[str, Any]] = validate.JSON_SCHEMA_CONFIG, + json_schema: Dict[str, Any] = validate.JSON_SCHEMA_CONFIG, ) -> None: """Validate the provided file.""" # perform the validation of the configuration file @@ -167,14 +167,10 @@ def configure( validate.JSON_SCHEMA_CONFIG, ) # if one or more exist, retrieve the name of the checks files - (found_checks_file, checks_file_name_list) = validate.extract_checks_file_name( - yml_data_dict - ) - output.console.print(found_checks_file) + (_, checks_file_name_list) = validate.extract_checks_file_name(yml_data_dict) # iteratively extract the contents of each checks file # and then validate the contents of that checks file for checks_file_name in checks_file_name_list: - output.console.print(checks_file_name) ( configuration_file_str, configuration_file_yml, diff --git a/chasten/validate.py b/chasten/validate.py index 80cd7921..75aa5a13 100644 --- a/chasten/validate.py +++ b/chasten/validate.py @@ -96,7 +96,7 @@ def extract_checks_file_name( def validate_configuration( configuration: Dict[str, Dict[str, Any]], - schema: Dict[str, Dict[str, Any]] = JSON_SCHEMA_CONFIG, + schema: Dict[str, Any] = JSON_SCHEMA_CONFIG, ) -> Tuple[bool, str]: """Validate the main configuration.""" # indicate that validation passed; since there diff --git a/tests/test_validate.py b/tests/test_validate.py index ffa044e6..ff349628 100644 --- a/tests/test_validate.py +++ b/tests/test_validate.py @@ -4,13 +4,13 @@ from hypothesis import given, strategies from hypothesis_jsonschema import from_schema -from chasten.validate import JSON_SCHEMA, validate_main_configuration +from chasten.validate import JSON_SCHEMA_CONFIG, validate_configuration def test_validate_config_valid_simple(): """Confirm that validation with built-in schema works for a simple valid example.""" valid_config_correct_schema = {"chasten": {"verbose": True, "debug-level": "ERROR"}} - is_valid, errors = validate_main_configuration(valid_config_correct_schema) + is_valid, errors = validate_configuration(valid_config_correct_schema) assert is_valid assert not errors @@ -29,7 +29,7 @@ def test_validate_config_valid_realistic(): ], } } - is_valid, errors = validate_main_configuration(valid_config_correct_schema) + is_valid, errors = validate_configuration(valid_config_correct_schema) assert is_valid assert not errors @@ -37,7 +37,7 @@ def test_validate_config_valid_realistic(): def test_validate_config_invalid_simple(): """Confirm that validation with built-in schema does not work for a simple invalid example.""" invalid_config_correct_schema = {"chasten": {"verbose": "yes"}} - is_valid, errors = validate_main_configuration(invalid_config_correct_schema) + is_valid, errors = validate_configuration(invalid_config_correct_schema) assert not is_valid assert errors assert "is not of type" in errors @@ -57,7 +57,7 @@ def test_validate_config_invalid_realistic(): ], } } - is_valid, errors = validate_main_configuration(valid_config_correct_schema) + is_valid, errors = validate_configuration(valid_config_correct_schema) assert not is_valid assert errors assert "is not of type" in errors @@ -69,7 +69,7 @@ def test_validate_config_invalid_realistic(): @pytest.mark.fuzz def test_validate_empty_config(config): """Use Hypothesis to confirm that an empty configuration will validate.""" - is_valid, errors = validate_main_configuration(config) + is_valid, errors = validate_configuration(config) assert is_valid assert not errors @@ -88,7 +88,7 @@ def test_validate_empty_config(config): @pytest.mark.fuzz def test_validate_config_with_verbose(config): """Use Hypothesis to confirm that a very simple valid schema will validate correctly.""" - is_valid, errors = validate_main_configuration(config) + is_valid, errors = validate_configuration(config) assert is_valid assert not errors @@ -107,15 +107,15 @@ def test_validate_config_with_verbose(config): @pytest.mark.fuzz def test_validate_config_with_debug_level(config): """Use Hypothesis to confirm that a simple valid schema will validate correctly.""" - is_valid, errors = validate_main_configuration(config) + is_valid, errors = validate_configuration(config) assert is_valid assert not errors -@given(from_schema(JSON_SCHEMA)) +@given(from_schema(JSON_SCHEMA_CONFIG)) @pytest.mark.fuzz def test_integers(config): """Use Hypothesis and the JSON schema plugin to confirm validation works for all possible valid instances.""" - is_valid, errors = validate_main_configuration(config) + is_valid, errors = validate_configuration(config) assert is_valid assert not errors