Exemplo n.º 1
0
 def test_finalize_response_debug_false(self):
     factory = APIRequestFactory()
     request = factory.get("/test_resources")
     response = Response({"data": {}})
     view = TestViewSet()
     view.headers = {}
     decorated_response = view.finalize_response(request, response)
     self.assertNotIn("meta", decorated_response.data)
Exemplo n.º 2
0
 def paged_list(self, request):
     items = range(100)
     self.apply_pagination(items)
     return Response(self.document.data)
Exemplo n.º 3
0
 def list(self, request):
     return Response("OK")
Exemplo n.º 4
0
 def test_init_with_context(self):
     context = {"key": "value"}
     response = Response(context=context)
     self.assertDictEqual(response.context, context)
Exemplo n.º 5
0
 def test_created_false(self):
     response = Response(status=status.HTTP_200_OK)
     self.assertFalse(response.created)
Exemplo n.º 6
0
 def test_created_true(self):
     response = Response(status=status.HTTP_201_CREATED)
     self.assertTrue(response.created)
Exemplo n.º 7
0
 def test_ok_error(self):
     response = Response(status=status.HTTP_400_BAD_REQUEST)
     self.assertFalse(response.ok)
Exemplo n.º 8
0
 def test_ok_success(self):
     response = Response(status=status.HTTP_200_OK)
     self.assertTrue(response.ok)