Skip to content

Commit

Permalink
[Cherry-Pick-Enterprise] Adding pagination to label relationship endp…
Browse files Browse the repository at this point in the history
…oint
  • Loading branch information
mkaliberda committed Jan 16, 2025
1 parent 5dad6dd commit b2b044b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/server/datamanager/tests/views/test_labelrelationship.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,49 @@ def test_project_label_relationship(self, client):
]
)

label_url = reverse(
"project-label-relationship-list",
kwargs={"project_uuid": self.project.uuid},
)

response = client.get(
f"{label_url}?page_size=1",
)

assert len(response.data["results"]) == 1
assert sorted(list(response.data["results"][0].keys())) == sorted(
[
"uuid",
"capture",
"label",
"label_value",
"capture_sample_sequence_start",
"capture_sample_sequence_end",
"label_info",
"segmenter",
"created_at",
"last_modified",
]
)

response = client.get(response.data["next"].replace("http://testserver", ""))

assert len(response.data["results"]) == 1
assert sorted(list(response.data["results"][0].keys())) == sorted(
[
"uuid",
"capture",
"label",
"label_value",
"capture_sample_sequence_start",
"capture_sample_sequence_end",
"label_info",
"segmenter",
"created_at",
"last_modified",
]
)

def test_project_label_relationship_delete_multi(self, client):
self.make_label_labelvalue(client)
clv = []
Expand Down
1 change: 1 addition & 0 deletions src/server/datamanager/views/label_relationship.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def get_queryset(self):
)
class ProjectLabelRelationshipListView(generics.ListAPIView):
serializer_class = V2CaptureLabelValueSerializer
pagination_class = QueryParamCursorPagination

permission_classes = (
permissions.IsAuthenticated,
Expand Down

0 comments on commit b2b044b

Please sign in to comment.