Commit 1fa2051c authored by Denis Laxalde's avatar Denis Laxalde
Browse files

Add tests for JSON Schema Pyramid renderer

This renderer is defined in
cubicweb_jsonschema/api/schema.py:includeme().
parent 4f41ab330599
......@@ -18,10 +18,18 @@
import base64
from datetime import date
from unittest import skip
import json
from unittest import (
TestCase,
skip,
)
import jsonschema
from mock import patch
from pyramid import (
renderers,
testing,
)
import six
from webob.multidict import MultiDict
......@@ -32,6 +40,24 @@ from cubicweb_jsonschema import VIEW_ROLE
from cubicweb_jsonschema.links import parse_links
class JSONSchemaRendererTC(TestCase):
def setUp(self):
self.config = testing.setUp()
self.config.include('cubicweb_jsonschema.api.schema')
def test_metaschema_for_object(self):
self.assertEqual(
renderers.render('jsonschema', {}),
'{"$schema": "http://json-schema.org/draft-06/schema#"}',
)
self.assertEqual(
json.loads(renderers.render('jsonschema', {'type': 'string'})),
{'$schema': 'http://json-schema.org/draft-06/schema#',
'type': 'string'},
)
class BaseTC(PyramidCWTest):
settings = {
......
Markdown is supported
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