From f2dd9659ff82d123a70b1a3d884c2674a5f2c0b5 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Wed, 2 Feb 2022 10:18:54 +0900 Subject: [PATCH] Enable to paginate project list api --- backend/api/tests/api/test_project.py | 6 +++--- backend/api/views/project.py | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/api/tests/api/test_project.py b/backend/api/tests/api/test_project.py index cf8efc3a..960d68af 100644 --- a/backend/api/tests/api/test_project.py +++ b/backend/api/tests/api/test_project.py @@ -15,13 +15,13 @@ class TestProjectList(CRUDMixin): def test_return_projects_to_member(self): for member in self.project.members: response = self.assert_fetch(member, status.HTTP_200_OK) - project = response.data[0] - self.assertEqual(len(response.data), 1) + project = response.data['results'][0] + self.assertEqual(response.data['count'], 1) self.assertEqual(project['id'], self.project.item.id) def test_does_not_return_project_to_non_member(self): response = self.assert_fetch(self.non_member, status.HTTP_200_OK) - self.assertEqual(len(response.data), 0) + self.assertEqual(response.data['count'], 0) class TestProjectCreate(CRUDMixin): diff --git a/backend/api/views/project.py b/backend/api/views/project.py index 57ac61c0..7f62b431 100644 --- a/backend/api/views/project.py +++ b/backend/api/views/project.py @@ -11,7 +11,6 @@ from ..serializers import ProjectPolymorphicSerializer class ProjectList(generics.ListCreateAPIView): serializer_class = ProjectPolymorphicSerializer - pagination_class = None def get_permissions(self): if self.request.method == 'GET':