summaryrefslogtreecommitdiffstats
path: root/test/test_schema.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:38:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:38:37 +0000
commitedb762c8af1ace09545c11f1342e8fe1abdae3b8 (patch)
tree642cd160bb22cc28e6672c1baea60a49476d71b2 /test/test_schema.py
parentReleasing progress-linux version 24.5.1-1~progress7.99u1. (diff)
downloadpython-ansible-compat-edb762c8af1ace09545c11f1342e8fe1abdae3b8.tar.xz
python-ansible-compat-edb762c8af1ace09545c11f1342e8fe1abdae3b8.zip
Merging upstream version 24.6.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/test_schema.py')
-rw-r--r--test/test_schema.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_schema.py b/test/test_schema.py
index 10c1a9a..91616a9 100644
--- a/test/test_schema.py
+++ b/test/test_schema.py
@@ -72,3 +72,16 @@ def test_schema(index: int) -> None:
def test_json_path() -> None:
"""Test json_path function."""
assert json_path(["a", 1, "b"]) == "$.a[1].b"
+
+
+def test_validate_invalid_schema() -> None:
+ """Test validate function error handling."""
+ schema = "[]"
+ data = json_from_asset("assets/validate0_data.json")
+ errors = validate(schema, data)
+
+ assert len(errors) == 1
+ assert (
+ errors[0].to_friendly()
+ == "In 'schema sanity check': Invalid schema, must be a mapping."
+ )