From 8782d6e68f9fb3667d0dd542dd0388e52c2cf14b Mon Sep 17 00:00:00 2001 From: Phil Budne Date: Mon, 4 May 2026 20:07:08 -0400 Subject: [PATCH] mediacloud/test/api_search_test.py: fix tests w/ missing sources found these two queries without sources or collections while testing some server side enforcement changes! --- mediacloud/test/api_search_test.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mediacloud/test/api_search_test.py b/mediacloud/test/api_search_test.py index fb59ba1..1ffb19d 100644 --- a/mediacloud/test/api_search_test.py +++ b/mediacloud/test/api_search_test.py @@ -14,7 +14,7 @@ START_DATE = dt.date(2023, 11, 1) END_DATE = dt.date(2023, 12, 1) -#Optionally override the target instance when testing, for staging/dev cases +# Optionally override the target instance when testing, for staging/dev cases mediacloud.api.BaseApi.BASE_API_URL = os.getenv("MC_API_BASE_URL", "https://search.mediacloud.org/api/") @@ -178,11 +178,13 @@ def test_story_list_sort_order(self): def test_search_by_indexed_date(self): # compare results with indexed_date clause to those without it - results1 = self._search.story_count(query="weather", start_date=START_DATE, end_date=END_DATE) + results1 = self._search.story_count(query="weather", start_date=START_DATE, end_date=END_DATE, + collection_ids=[COLLECTION_US_NATIONAL]) assert results1['total'] > 0 results2 = self._search.story_count(query="weather and indexed_date:[{} TO {}]".format( START_DATE.isoformat(), END_DATE.isoformat()), - start_date=START_DATE, end_date=END_DATE) + start_date=START_DATE, end_date=END_DATE, + collection_ids=[COLLECTION_US_NATIONAL]) assert results2['total'] > 0 assert results1['total'] == results2['total'] assert results1['relevant'] != results2['relevant']