﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24773	Add a JSON response to the test client	Andy McKay	Andy McKay	"I've got a few Django projects that are just JSON APIs and return JSON. If you want to test those in the test client, you have to parse the response into JSON. Each and every test call. For example:

{{{
def test_ok(self):
   assert json.loads(self.client.get(url).content)['modified']
}}}

What would be nice is to have json on the test client, which can be parsed if the response is application/json. We can mimic the requests interface here:

http://docs.python-requests.org/en/latest/api/?highlight=json#requests.Response.json

So it would look like this:

{{{
def test_ok(self):
   assert self.client.get(url).json()['modified']
}}}

I wouldn't suggest we do this for every content type, but JSON is everywhere. Like glitter."	New feature	closed	Testing framework	dev	Normal	fixed			Accepted	1	0	0	1	0	0
