def test_render_priority(): v = json.ViewJSON() assert v.render_priority(b"", content_type="application/json") assert v.render_priority(b"", content_type="application/json-rpc") assert v.render_priority(b"", content_type="application/vnd.api+json") assert v.render_priority(b"", content_type="application/acme+json") assert not v.render_priority(b"", content_type="text/plain")
def test_view_json(): v = full_eval(json.ViewJSON()) assert v(b"null") assert v(b"{}") assert not v(b"{") assert v(b"[1, 2, 3, 4, 5]") assert v(b'{"foo" : 3}') assert v(b'{"foo": true, "nullvalue": null}')
def test_view_json_doesnt_crash(data): v = full_eval(json.ViewJSON()) v(data)