def test_custom_default(self): # no accept header, should return user specified default view. decorator = content_negotiation({'application/xml': xml_view, 'text/html': html_view}, default_type="application/json") negotiated_view = decorator(json_view) response = negotiated_view(self.request) self.assertEqual("JSON", response.content)
def setUp(self): self.request = HttpRequest() # add content negotiation to test view defined above for testing decorator = content_negotiation({'application/xml': xml_view}) self.negotiated_view = decorator(html_view)