Skip to content

Commit e01f8b8

Browse files
authored
[Cherry-Pick-Main][Server] Adding pagination to label relationship endpoint (#57)
1 parent 5dad6dd commit e01f8b8

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

src/server/datamanager/tests/views/test_labelrelationship.py

+43
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,49 @@ def test_project_label_relationship(self, client):
974974
]
975975
)
976976

977+
label_url = reverse(
978+
"project-label-relationship-list",
979+
kwargs={"project_uuid": self.project.uuid},
980+
)
981+
982+
response = client.get(
983+
f"{label_url}?page_size=1",
984+
)
985+
986+
assert len(response.data["results"]) == 1
987+
assert sorted(list(response.data["results"][0].keys())) == sorted(
988+
[
989+
"uuid",
990+
"capture",
991+
"label",
992+
"label_value",
993+
"capture_sample_sequence_start",
994+
"capture_sample_sequence_end",
995+
"label_info",
996+
"segmenter",
997+
"created_at",
998+
"last_modified",
999+
]
1000+
)
1001+
1002+
response = client.get(response.data["next"].replace("http://testserver", ""))
1003+
1004+
assert len(response.data["results"]) == 1
1005+
assert sorted(list(response.data["results"][0].keys())) == sorted(
1006+
[
1007+
"uuid",
1008+
"capture",
1009+
"label",
1010+
"label_value",
1011+
"capture_sample_sequence_start",
1012+
"capture_sample_sequence_end",
1013+
"label_info",
1014+
"segmenter",
1015+
"created_at",
1016+
"last_modified",
1017+
]
1018+
)
1019+
9771020
def test_project_label_relationship_delete_multi(self, client):
9781021
self.make_label_labelvalue(client)
9791022
clv = []

src/server/datamanager/views/label_relationship.py

+1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ def get_queryset(self):
164164
)
165165
class ProjectLabelRelationshipListView(generics.ListAPIView):
166166
serializer_class = V2CaptureLabelValueSerializer
167+
pagination_class = QueryParamCursorPagination
167168

168169
permission_classes = (
169170
permissions.IsAuthenticated,

0 commit comments

Comments
 (0)