1212 OpportunitySearchStatus ,
1313 OpportunitySearchStatusCode ,
1414)
15- from stapi_fastapi .models .product import Product
1615from stapi_fastapi .models .shared import Link
1716
1817from .shared import (
2726from .test_datetime_interval import rfc3339_strftime
2827
2928
30- @pytest .mark .parametrize ("mock_products" , [[product_test_spotlight ]])
31- def test_no_opportunity_search_advertised (
32- stapi_client : TestClient , mock_products : list [Product ]
33- ) -> None :
29+ @pytest .mark .mock_products ([product_test_spotlight ])
30+ def test_no_opportunity_search_advertised (stapi_client : TestClient ) -> None :
3431 product_id = "test-spotlight"
3532
3633 # the `/products/{productId}/opportunities link should not be advertised on the product
@@ -44,10 +41,8 @@ def test_no_opportunity_search_advertised(
4441 assert find_link (root_body ["links" ], "opportunity-search-records" ) is None
4542
4643
47- @pytest .mark .parametrize ("mock_products" , [[product_test_spotlight_sync_opportunity ]])
48- def test_only_sync_search_advertised (
49- stapi_client : TestClient , mock_products : list [Product ]
50- ) -> None :
44+ @pytest .mark .mock_products ([product_test_spotlight_sync_opportunity ])
45+ def test_only_sync_search_advertised (stapi_client : TestClient ) -> None :
5146 product_id = "test-spotlight"
5247
5348 # the `/products/{productId}/opportunities link should be advertised on the product
@@ -69,9 +64,7 @@ def test_only_sync_search_advertised(
6964 [product_test_spotlight_sync_async_opportunity ],
7065 ],
7166)
72- def test_async_search_advertised (
73- stapi_client_async_opportunity : TestClient , mock_products : list [Product ]
74- ) -> None :
67+ def test_async_search_advertised (stapi_client_async_opportunity : TestClient ) -> None :
7568 product_id = "test-spotlight"
7669
7770 # the `/products/{productId}/opportunities link should be advertised on the product
@@ -85,16 +78,10 @@ def test_async_search_advertised(
8578 assert find_link (root_body ["links" ], "opportunity-search-records" )
8679
8780
88- def test_sync_search_response () -> None :
89- # handled in test_opportunity.py
90- pass
91-
92-
93- @pytest .mark .parametrize ("mock_products" , [[product_test_spotlight_async_opportunity ]])
81+ @pytest .mark .mock_products ([product_test_spotlight_async_opportunity ])
9482def test_async_search_response (
9583 stapi_client_async_opportunity : TestClient ,
9684 opportunity_search : dict [str , Any ],
97- mock_products : list [Product ],
9885) -> None :
9986 product_id = "test-spotlight"
10087 url = f"/products/{ product_id } /opportunities"
@@ -111,13 +98,10 @@ def test_async_search_response(
11198 assert find_link (body ["links" ], "self" )
11299
113100
114- @pytest .mark .parametrize (
115- "mock_products" , [[product_test_spotlight_sync_async_opportunity ]]
116- )
101+ @pytest .mark .mock_products ([product_test_spotlight_async_opportunity ])
117102def test_async_search_is_default (
118103 stapi_client_async_opportunity : TestClient ,
119104 opportunity_search : dict [str , Any ],
120- mock_products : list [Product ],
121105) -> None :
122106 product_id = "test-spotlight"
123107 url = f"/products/{ product_id } /opportunities"
@@ -132,13 +116,10 @@ def test_async_search_is_default(
132116 pytest .fail ("response is not an opportunity search record" )
133117
134118
135- @pytest .mark .parametrize (
136- "mock_products" , [[product_test_spotlight_sync_async_opportunity ]]
137- )
119+ @pytest .mark .mock_products ([product_test_spotlight_sync_async_opportunity ])
138120def test_prefer_header (
139121 stapi_client_async_opportunity : TestClient ,
140122 opportunity_search : dict [str , Any ],
141- mock_products : list [Product ],
142123) -> None :
143124 product_id = "test-spotlight"
144125 url = f"/products/{ product_id } /opportunities"
@@ -170,11 +151,10 @@ def test_prefer_header(
170151 pytest .fail ("response is not an opportunity search record" )
171152
172153
173- @pytest .mark .parametrize ( " mock_products" , [[ product_test_spotlight_async_opportunity ] ])
154+ @pytest .mark .mock_products ([ product_test_spotlight_async_opportunity ])
174155def test_async_search_record_retrieval (
175156 stapi_client_async_opportunity : TestClient ,
176157 opportunity_search : dict [str , Any ],
177- mock_products : list [Product ],
178158) -> None :
179159 # post an async search
180160 product_id = "test-spotlight"
@@ -201,11 +181,10 @@ def test_async_search_record_retrieval(
201181 ]
202182
203183
204- @pytest .mark .parametrize ( " mock_products" , [[ product_test_spotlight_async_opportunity ] ])
184+ @pytest .mark .mock_products ([ product_test_spotlight_async_opportunity ])
205185def test_async_opportunity_search_to_completion (
206186 stapi_client_async_opportunity : TestClient ,
207187 opportunity_search : dict [str , Any ],
208- mock_products : list [Product ],
209188 url_for : Callable [[str ], str ],
210189) -> None :
211190 # Post a request for an async search
@@ -269,7 +248,7 @@ def test_async_opportunity_search_to_completion(
269248 )
270249
271250 # Verify we can retrieve the OpportunityCollection from the
272- # OpportunitySearchRecord's `opportunities` link, and the retrieved
251+ # OpportunitySearchRecord's `opportunities` link; verify the retrieved
273252 # OpportunityCollection contains an order link and a link pointing back to the
274253 # OpportunitySearchRecord
275254 opportunities_link = next (
@@ -283,11 +262,10 @@ def test_async_opportunity_search_to_completion(
283262 assert any (x for x in retrieved_collection .links if x .rel == "search-record" )
284263
285264
286- @pytest .mark .parametrize ( " mock_products" , [[ product_test_spotlight_async_opportunity ] ])
265+ @pytest .mark .mock_products ([ product_test_spotlight_async_opportunity ])
287266def test_new_search_location_header_matches_self_link (
288267 stapi_client_async_opportunity : TestClient ,
289268 opportunity_search : dict [str , Any ],
290- mock_products : list [Product ],
291269) -> None :
292270 product_id = "test-spotlight"
293271 url = f"/products/{ product_id } /opportunities"
@@ -300,7 +278,7 @@ def test_new_search_location_header_matches_self_link(
300278 assert search_response .headers ["Location" ] == str (link ["href" ])
301279
302280
303- @pytest .mark .parametrize ( " mock_products" , [[ product_test_spotlight_async_opportunity ] ])
281+ @pytest .mark .mock_products ([ product_test_spotlight_async_opportunity ])
304282def test_bad_ids (stapi_client_async_opportunity : TestClient ) -> None :
305283 search_record_id = "bad_id"
306284 res = stapi_client_async_opportunity .get (
@@ -319,7 +297,6 @@ def test_bad_ids(stapi_client_async_opportunity: TestClient) -> None:
319297@pytest .fixture
320298def setup_search_record_pagination (
321299 stapi_client_async_opportunity : TestClient ,
322- mock_products : list [Product ],
323300) -> list [dict [str , Any ]]:
324301 product_id = "test-spotlight"
325302 search_records = []
@@ -357,10 +334,9 @@ def setup_search_record_pagination(
357334
358335
359336@pytest .mark .parametrize ("limit" , [0 , 1 , 2 , 4 ])
360- @pytest .mark .parametrize ( " mock_products" , [[ product_test_spotlight_async_opportunity ] ])
337+ @pytest .mark .mock_products ([ product_test_spotlight_async_opportunity ])
361338def test_get_search_records_pagination (
362339 stapi_client_async_opportunity : TestClient ,
363- mock_products : list [Product ],
364340 setup_search_record_pagination : list [dict [str , Any ]],
365341 limit : int ,
366342) -> None :
0 commit comments