def test_json(self): ref = {"foo": [1, 2, 3], "12": "string"} response = jsonify(lambda r: r)(ref) ok_(isinstance(response, http.HttpResponse)) ok_(response.status_code, 200) eq_(response["Access-Control-Allow-Origin"], "*") r_data = json.loads(response.content) eq_(r_data, ref)
def test_json(self): ref = {'foo': [1, 2, 3], '12': "string"} response = jsonify(lambda r: r)(ref) ok_(isinstance(response, http.HttpResponse)) ok_(response.status_code, 200) eq_(response["Access-Control-Allow-Origin"], "*") r_data = json.loads(response.content) eq_(r_data, ref)
def test_fail(self): ref = http.HttpResponseBadRequest('oh picky') response = jsonify(lambda r: r)(ref) eq_(response["Access-Control-Allow-Origin"], "*") eq_(ref, response)