示例#1
0
 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)
示例#2
0
 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)
示例#3
0
    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)
示例#4
0
    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)