diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 13:38:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 13:38:37 +0000 |
commit | 23e67a23a7b57fa5cb6fc92bd0843c3707d56ef9 (patch) | |
tree | 88110359f0deb3bb263ade4ed0e888da6b7fdea4 /test/test_schema.py | |
parent | Adding upstream version 24.5.1. (diff) | |
download | python-ansible-compat-upstream.tar.xz python-ansible-compat-upstream.zip |
Adding upstream version 24.6.0.upstream/24.6.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/test_schema.py')
-rw-r--r-- | test/test_schema.py | 13 |
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." + ) |