Files
sentinel/fixtures/schema_validation.py
2024-02-15 17:01:50 +00:00

23 lines
505 B
Python

import pytest
from jsonschema import ValidationError
def invalid_schema(func):
def inner(self, *args, **kwargs):
with pytest.raises(ValidationError):
func(self)
return inner
def invalid_schema_with_error_message(message):
def decorator(func):
def inner(self, *args, **kwargs):
with pytest.raises(ValidationError) as excinfo:
func(self)
assert excinfo.value.message == message
return inner
return decorator