Using Django.test.client to check template vars
- by scott
I've got a view that I'm trying to test with the Client object. Can I get to the variables I injected into the render_to_response of my view?
Example View:
def myView(request):
if request.method == "POST":
# do the search
return render_to_response('search.html',{'results':results},context_instance=RequestContext(request))
else:
return render_to_response('search.html',context_instance=RequestContext(request)
Test:
c = Client()
response = c.post('/school/search/', {'keyword':'beagles'})
# how do I get to the 'results' variable??