Commit ef723c7a authored by Denis Laxalde's avatar Denis Laxalde
Browse files

Catch invalid value in JSON Schema renderer

A JSON Schema must be a Boolean or an object.
parent e142fe482ba0
......@@ -199,6 +199,9 @@ def includeme(config):
elif not isinstance(value, bool):
raise ValueError(
"JSON Schema value must be of object or boolean type")
return json.dumps(value, **kwargs)
......@@ -62,6 +62,10 @@ class JSONSchemaRendererTC(TestCase):
self.assertEqual(renderers.render('jsonschema', value),
def test_invalid_value(self):
with self.assertRaises(ValueError):
renderers.render('jsonschema', 'a')
class BaseTC(PyramidCWTest):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment