schema_validation.py 505 B

12345678910111213141516171819202122
  1. import pytest
  2. from jsonschema import ValidationError
  3. def invalid_schema(func):
  4. def inner(self, *args, **kwargs):
  5. with pytest.raises(ValidationError):
  6. func(self)
  7. return inner
  8. def invalid_schema_with_error_message(message):
  9. def decorator(func):
  10. def inner(self, *args, **kwargs):
  11. with pytest.raises(ValidationError) as excinfo:
  12. func(self)
  13. assert excinfo.value.message == message
  14. return inner
  15. return decorator