1818END = START + timedelta (days = 5 )
1919
2020
21+ def test_empty_order (stapi_client : TestClient ):
22+ res = stapi_client .get ("/orders" )
23+ default_orders = {"type" : "FeatureCollection" , "features" : [], "links" : []}
24+ assert res .status_code == status .HTTP_200_OK
25+ assert res .headers ["Content-Type" ] == "application/geo+json"
26+ assert res .json () == default_orders
27+
28+
2129@pytest .fixture
2230def create_order_allowed_payloads () -> list [OrderPayload ]:
2331 return [
@@ -194,33 +202,6 @@ def create_order_payloads() -> list[OrderPayload]:
194202 return payloads
195203
196204
197- def test_empty_order (stapi_client : TestClient ):
198- res = stapi_client .get ("/orders" )
199- default_orders = {"type" : "FeatureCollection" , "features" : [], "links" : []}
200- assert res .status_code == status .HTTP_200_OK
201- assert res .headers ["Content-Type" ] == "application/geo+json"
202- assert res .json () == default_orders
203-
204-
205- @pytest .fixture
206- def prepare_order_pagination (
207- stapi_client : TestClient , create_order_payloads : list [OrderPayload ]
208- ) -> None :
209- product_id = "test-spotlight"
210- # get uuids created to use as pagination tokens
211- for payload in create_order_payloads :
212- res = stapi_client .post (
213- f"products/{ product_id } /orders" ,
214- json = payload .model_dump (),
215- )
216- assert res .status_code == status .HTTP_201_CREATED , res .text
217- assert res .headers ["Content-Type" ] == "application/geo+json"
218-
219- res = stapi_client .get ("/orders" )
220- checker = res .json ()
221- assert len (checker ["features" ]) == 3
222-
223-
224205def test_order_pagination (
225206 prepare_order_pagination ,
226207 stapi_client : TestClient ,
@@ -247,4 +228,3 @@ def test_token_not_found(stapi_client: TestClient):
247228 res = stapi_client .get ("/orders" , params = {"next" : "a_token" })
248229 # should return 404 as a result of bad token
249230 assert res .status_code == status .HTTP_404_NOT_FOUND
250-
0 commit comments