@@ -87,21 +87,21 @@ async def test_get_feeds_pagination():
8787 api = OperationsApiImpl ()
8888
8989 response = await api .get_feeds (limit = 1 )
90- assert response .total == 1
90+ assert response .total == 3
9191 assert response .limit == 1
9292 assert response .offset == 0
9393 assert len (response .feeds ) == 1
9494 first_feed = response .feeds [0 ]
9595
9696 response = await api .get_feeds (offset = 1 , limit = 1 )
97- assert response .total == 1
97+ assert response .total == 3
9898 assert response .limit == 1
9999 assert response .offset == 1
100100 assert len (response .feeds ) == 1
101101 assert response .feeds [0 ].stable_id != first_feed .stable_id
102102
103103 response = await api .get_feeds (offset = 3 )
104- assert response .total == 0
104+ assert response .total == 3
105105 assert response .limit == 50
106106 assert response .offset == 3
107107 assert len (response .feeds ) == 0
@@ -149,26 +149,20 @@ async def test_get_feeds_combined_filters():
149149
150150 base_response = await api .get_feeds ()
151151 assert base_response is not None
152- print (f"\n Total feeds in database: { len (base_response .feeds )} " )
153152
154153 gtfs_response = await api .get_feeds (data_type = "gtfs" )
155154 assert gtfs_response is not None
156- print (f"Total GTFS feeds: { len (gtfs_response .feeds )} " )
157- for feed in gtfs_response .feeds :
158- print (f"GTFS Feed: { feed .stable_id } , status: { feed .operational_status } " )
159155
160156 wip_response = await api .get_feeds (operation_status = "wip" )
161157 assert wip_response is not None
162- print (f"Total WIP feeds: { len (wip_response .feeds )} " )
163- for feed in wip_response .feeds :
164- print (f"WIP Feed: { feed .stable_id } , type: { feed .data_type } " )
165158
166- response = await api .get_feeds (data_type = "gtfs" , operation_status = "wip " )
159+ response = await api .get_feeds (data_type = "gtfs" , operation_status = "published " )
167160 assert response is not None
168161 wip_gtfs_feeds = response .feeds
169- print (f"Total WIP GTFS feeds: { len (wip_gtfs_feeds )} " )
170162
171- assert len (wip_gtfs_feeds ) == 0
163+ assert len (wip_gtfs_feeds ) == 1
164+ assert wip_gtfs_feeds [0 ].data_type == "gtfs"
165+ assert wip_gtfs_feeds [0 ].operational_status == "published"
172166
173167 response = await api .get_feeds (data_type = "gtfs" , limit = 1 , offset = 1 )
174168 assert response is not None
@@ -231,3 +225,35 @@ async def test_get_feeds_unpublished_with_data_type():
231225 for feed in rt_response .feeds :
232226 assert feed .operational_status == "unpublished"
233227 assert feed .data_type == "gtfs_rt"
228+
229+
230+ @pytest .mark .asyncio
231+ async def test_get_feeds_search_query ():
232+ """
233+ Test get_feeds endpoint with search query filter.
234+ Should return only feeds matching the search query.
235+ """
236+ api = OperationsApiImpl ()
237+
238+ response = await api .get_feeds (search_query = "RT" )
239+ assert response is not None
240+ assert response .total == 1
241+ assert len (response .feeds ) == 1
242+ assert response .feeds [0 ].feed_name == "London Transit Commission(RT"
243+
244+ response = await api .get_feeds (search_query = " Provider B " )
245+ assert response is not None
246+ assert response .total == 1
247+ assert len (response .feeds ) == 1
248+ assert response .feeds [0 ].provider == "provider B"
249+
250+ response = await api .get_feeds (search_query = "mdb-41" )
251+ assert response is not None
252+ assert response .total == 1
253+ assert len (response .feeds ) == 1
254+ assert response .feeds [0 ].stable_id == "mdb-41"
255+
256+ response = await api .get_feeds (search_query = "mdb" )
257+ assert response is not None
258+ assert response .total == 3
259+ assert len (response .feeds ) == 3
0 commit comments