Skip to content

Commit

Permalink
Merge dfb21a5 into e4ad67b
Browse files Browse the repository at this point in the history
  • Loading branch information
TimJentzsch committed Jan 15, 2022
2 parents e4ad67b + dfb21a5 commit beecc15
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class Meta:
"archived",
"cannot_ocr",
"redis_id",
"removed_from_queue",
)
# TODO: Omitting the below line while adding `transcription_set` makes
# a call to a single submission created with the test data set take
Expand Down
25 changes: 25 additions & 0 deletions api/tests/submissions/test_submission_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,28 @@ def test_list_with_contains_filters(
)
assert result.status_code == status.HTTP_200_OK
assert len(result.json()["results"]) == result_count

@pytest.mark.parametrize(
"filter_str,result_count",
[("removed_from_queue=true", 1), ("removed_from_queue=false", 1), ("", 2)],
)
def test_list_with_removed_filter(
self, client: Client, filter_str: str, result_count: int
) -> None:
"""Verify that submissions can be filtered by their removal status."""
client, headers, user = setup_user_client(client, id=123)

create_submission(
id=1, removed_from_queue=True,
)
create_submission(
id=2, removed_from_queue=False,
)

result = client.get(
reverse("submission-list") + f"?{filter_str}",
content_type="application/json",
**headers,
)
assert result.status_code == status.HTTP_200_OK
assert len(result.json()["results"]) == result_count
1 change: 1 addition & 0 deletions api/views/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class SubmissionViewSet(viewsets.ModelViewSet):
"archived": ["exact"],
"content_url": ["exact", "isnull"],
"redis_id": ["exact", "isnull"],
"removed_from_queue": ["exact"],
}
ordering_fields = [
"id",
Expand Down

0 comments on commit beecc15

Please sign in to comment.