@@ -67,10 +67,10 @@ def search_response(item_descriptions):
6767
6868@respx .mock
6969@pytest .mark .asyncio
70- async def test_search_aiter_basic (item_descriptions ,
71- search_filter ,
72- search_response ,
73- session ):
70+ async def test_search_basic (item_descriptions ,
71+ search_filter ,
72+ search_response ,
73+ session ):
7474
7575 quick_search_url = f'{ TEST_URL } /quick-search'
7676 next_page_url = f'{ TEST_URL } /blob/?page_marker=IAmATest'
@@ -89,10 +89,10 @@ async def test_search_aiter_basic(item_descriptions,
8989 respx .get (next_page_url ).return_value = mock_resp2
9090
9191 cl = DataClient (session , base_url = TEST_URL )
92- item_aiter = cl . search_aiter ([ 'PSScene' ],
93- search_filter ,
94- name = 'quick_search' )
95- items_list = [ i async for i in item_aiter ]
92+ items_list = [
93+ i async for i in cl . search (
94+ [ 'PSScene' ], search_filter , name = 'quick_search' )
95+ ]
9696
9797 # check that request is correct
9898 expected_request = {
@@ -109,10 +109,10 @@ async def test_search_aiter_basic(item_descriptions,
109109
110110@respx .mock
111111@pytest .mark .asyncio
112- async def test_search_aiter_sort (item_descriptions ,
113- search_filter ,
114- search_response ,
115- session ):
112+ async def test_search_sort (item_descriptions ,
113+ search_filter ,
114+ search_response ,
115+ session ):
116116
117117 sort = 'acquired asc'
118118 quick_search_url = f'{ TEST_URL } /quick-search?_sort={ sort } '
@@ -125,18 +125,17 @@ async def test_search_aiter_sort(item_descriptions,
125125 # if the sort parameter is not used correctly, the client will not send
126126 # the request to the mocked endpoint and this test will fail
127127 cl = DataClient (session , base_url = TEST_URL )
128- item_aiter = cl .search_aiter (['PSScene' ], search_filter , sort = sort )
129128
130129 # run through the iterator to actually initiate the call
131- [i async for i in item_aiter ]
130+ [i async for i in cl . search ([ 'PSScene' ], search_filter , sort = sort ) ]
132131
133132
134133@respx .mock
135134@pytest .mark .asyncio
136- async def test_search_aiter_limit (item_descriptions ,
137- search_filter ,
138- search_response ,
139- session ):
135+ async def test_search_limit (item_descriptions ,
136+ search_filter ,
137+ search_response ,
138+ session ):
140139
141140 quick_search_url = f'{ TEST_URL } /quick-search'
142141
@@ -148,8 +147,9 @@ async def test_search_aiter_limit(item_descriptions,
148147 respx .post (quick_search_url ).return_value = mock_resp
149148
150149 cl = DataClient (session , base_url = TEST_URL )
151- item_aiter = cl .search_aiter (['PSScene' ], search_filter , limit = 2 )
152- items_list = [i async for i in item_aiter ]
150+ items_list = [
151+ i async for i in cl .search (['PSScene' ], search_filter , limit = 2 )
152+ ]
153153
154154 # check only the first two results were returned
155155 assert items_list == item_descriptions [:2 ]
@@ -297,19 +297,18 @@ async def test_update_search_basic(search_filter, session):
297297@respx .mock
298298@pytest .mark .asyncio
299299@pytest .mark .parametrize ("limit, expected_list_length" , [(None , 4 ), (3 , 3 )])
300- async def test_list_searches_aiter_success (limit ,
301- expected_list_length ,
302- search_result ,
303- session ):
300+ async def test_list_searches_success (limit ,
301+ expected_list_length ,
302+ search_result ,
303+ session ):
304304 page1_response = {"_links" : {}, "searches" : [search_result ] * 4 }
305305 route = respx .get (TEST_SEARCHES_URL )
306306 route .return_value = httpx .Response (200 , json = page1_response )
307307
308308 cl = DataClient (session , base_url = TEST_URL )
309309
310- search_aiter = cl .list_searches_aiter (limit = limit )
311- searches_list_length = len ([s async for s in search_aiter ])
312- assert searches_list_length == expected_list_length
310+ assert len ([s async for s in cl .list_searches (limit = limit )
311+ ]) == expected_list_length
313312
314313 assert route .called
315314
@@ -320,19 +319,17 @@ async def test_list_searches_aiter_success(limit,
320319 "sort, search_type, expectation" ,
321320 [('DOESNOTEXIST' , 'ANY' , pytest .raises (exceptions .ClientError )),
322321 ('CREATED DESC' , 'DOESNOTEXIST' , pytest .raises (exceptions .ClientError ))])
323- async def test_list_searches_aiter_args_do_not_match (sort ,
324- search_type ,
325- expectation ,
326- session ):
322+ async def test_list_searches_args_do_not_match (sort ,
323+ search_type ,
324+ expectation ,
325+ session ):
327326 route = respx .get (TEST_SEARCHES_URL )
328327 route .return_value = httpx .Response (200 , json = {})
329328
330329 cl = DataClient (session , base_url = TEST_URL )
331330
332331 with expectation :
333- searches_aiter = cl .list_searches_aiter (sort = sort ,
334- search_type = search_type )
335- [s async for s in searches_aiter ]
332+ [s async for s in cl .list_searches (sort = sort , search_type = search_type )]
336333
337334 assert not route .called
338335
@@ -357,7 +354,7 @@ async def test_delete_search(retcode, expectation, session):
357354
358355@respx .mock
359356@pytest .mark .asyncio
360- async def test_run_search_aiter_success (item_descriptions , session ):
357+ async def test_run_search_success (item_descriptions , session ):
361358 sid = 'search_id'
362359 route = respx .get (f'{ TEST_SEARCHES_URL } /{ sid } /results' )
363360
@@ -376,8 +373,7 @@ async def test_run_search_aiter_success(item_descriptions, session):
376373 respx .get (next_page_url ).return_value = mock_resp2
377374
378375 cl = DataClient (session , base_url = TEST_URL )
379- item_aiter = cl .run_search_aiter (sid )
380- items_list = [i async for i in item_aiter ]
376+ items_list = [i async for i in cl .run_search (sid )]
381377
382378 assert route .called
383379
@@ -387,17 +383,14 @@ async def test_run_search_aiter_success(item_descriptions, session):
387383
388384@respx .mock
389385@pytest .mark .asyncio
390- async def test_run_search_aiter_doesnotexist (session ):
386+ async def test_run_search_doesnotexist (session ):
391387 sid = 'search_id'
392388 route = respx .get (f'{ TEST_SEARCHES_URL } /{ sid } /results' )
393389 route .return_value = httpx .Response (404 )
394390
395391 cl = DataClient (session , base_url = TEST_URL )
396392 with pytest .raises (exceptions .APIError ):
397- item_aiter = cl .run_search_aiter (sid )
398- # this won't throw the error until the iterator is processed
399- # issue 476
400- [i async for i in item_aiter ]
393+ [i async for i in cl .run_search (sid )]
401394
402395 assert route .called
403396
0 commit comments