Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
AetherUnbound committed Feb 6, 2023
1 parent fe53a04 commit 65f2df5
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions api/test/unit/controllers/test_search_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,3 +463,40 @@ def test_search_tallies_pages_less_than_5(
assert len(passed_results) == number_of_results_passed
else:
count_provider_occurrences_mock.assert_not_called()


@pytest.mark.parametrize(
"index",
(
"image",
"audio",
),
)
@mock.patch.object(
tallies, "count_provider_occurrences", wraps=tallies.count_provider_occurrences
)
@mock.patch(
"catalog.api.controllers.search_controller._post_process_results",
)
@pytest.mark.django_db
def test_search_tallies_handles_empty_page(
mock_post_process_results,
count_provider_occurrences_mock: mock.MagicMock,
index,
request_factory,
):
mock_post_process_results.return_value = None

serializer = MediaSearchRequestSerializer(data={"q": "dogs"})
serializer.is_valid()

search_controller.search(
search_params=serializer,
ip=0,
index=index,
page_size=100, # High page size to trigger potential results past 80
request=request_factory.get("/"),
filter_dead=True,
)

count_provider_occurrences_mock.assert_not_called()

0 comments on commit 65f2df5

Please sign in to comment.