def test_json_request_parser_invalid_json_with_valid_content_type(): with app.test_request_context('/?one=1', content_type='application/json', data='{"one": 1, "two": "2", "äåö": -.öäå"}'): g.ctx = Context() mixin = JsonRequestParser() mixin.before()
def test_json_request_parser_valid_json_but_invalid_content_type(): data = {'one': 1, 'two': '2', u'äåö': u'-.öäå'} import json with app.test_request_context('/?one=1', content_type='text/json', data=json.dumps(data)): g.ctx = Context() mixin = JsonRequestParser() mixin.before()
def test_json_request_parser_valid_json(): data = {'one': 1, 'two': '2', u'äåö': u'-.öäå'} import json with app.test_request_context('/?one=1', content_type='application/json', data=json.dumps(data)): g.ctx = Context() mixin = JsonRequestParser() mixin.before() compare(g.ctx.input, data)