diff --git a/local_hooks/app_tests/app_schema.json b/local_hooks/app_tests/app_schema.json index b4f785b..40dbcfb 100644 --- a/local_hooks/app_tests/app_schema.json +++ b/local_hooks/app_tests/app_schema.json @@ -147,6 +147,7 @@ "ph", "timezone", "file", + "python_script", "object", "array" ] diff --git a/local_hooks/tests/test_static_tests.py b/local_hooks/tests/test_static_tests.py index f049222..5372db8 100644 --- a/local_hooks/tests/test_static_tests.py +++ b/local_hooks/tests/test_static_tests.py @@ -7,6 +7,7 @@ from unittest.mock import Mock, patch import pytest +from jsonschema.validators import Draft202012Validator from pathlib import Path from local_hooks.app_tests.json_tests import JSONTests @@ -16,6 +17,18 @@ logging.getLogger().setLevel(logging.INFO) +def test_python_script_is_valid_asset_configuration_type(): + schema_path = Path(__file__).parents[1] / "app_tests" / "app_schema.json" + app_schema = json.loads(schema_path.read_text()) + configuration_schema = app_schema["properties"]["configuration"] + + errors = Draft202012Validator(configuration_schema).iter_errors( + {"parser": {"data_type": "python_script"}} + ) + + assert list(errors) == [] + + def copy_app_dir(request: pytest.FixtureRequest) -> Path: app_dir = Path(request.param) # type: ignore app_dir_copy = Path(f"{app_dir}_copy")