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)
def paged_list(self, request): items = range(100) self.apply_pagination(items) return Response(self.document.data)
def list(self, request): return Response("OK")
def test_init_with_context(self): context = {"key": "value"} response = Response(context=context) self.assertDictEqual(response.context, context)
def test_created_false(self): response = Response(status=status.HTTP_200_OK) self.assertFalse(response.created)
def test_created_true(self): response = Response(status=status.HTTP_201_CREATED) self.assertTrue(response.created)
def test_ok_error(self): response = Response(status=status.HTTP_400_BAD_REQUEST) self.assertFalse(response.ok)
def test_ok_success(self): response = Response(status=status.HTTP_200_OK) self.assertTrue(response.ok)