3333}
3434
3535
36+ @pytest .mark .asyncio
3637async def test_post_search_content_type (app_client , ctx ):
3738 params = {"limit" : 1 }
3839 resp = await app_client .post ("/search" , json = params )
3940 assert resp .headers ["content-type" ] == "application/geo+json"
4041
4142
43+ @pytest .mark .asyncio
4244async def test_get_search_content_type (app_client , ctx ):
4345 resp = await app_client .get ("/search" )
4446 assert resp .headers ["content-type" ] == "application/geo+json"
4547
4648
49+ @pytest .mark .asyncio
4750async def test_api_headers (app_client ):
4851 resp = await app_client .get ("/api" )
4952 assert (
@@ -52,11 +55,13 @@ async def test_api_headers(app_client):
5255 assert resp .status_code == 200
5356
5457
58+ @pytest .mark .asyncio
5559async def test_router (app ):
5660 api_routes = set ([f"{ list (route .methods )[0 ]} { route .path } " for route in app .routes ])
5761 assert len (api_routes - ROUTES ) == 0
5862
5963
64+ @pytest .mark .asyncio
6065async def test_app_transaction_extension (app_client , ctx ):
6166 item = copy .deepcopy (ctx .item )
6267 item ["id" ] = str (uuid .uuid4 ())
@@ -66,6 +71,7 @@ async def test_app_transaction_extension(app_client, ctx):
6671 await app_client .delete (f"/collections/{ item ['collection' ]} /items/{ item ['id' ]} " )
6772
6873
74+ @pytest .mark .asyncio
6975async def test_app_search_response (app_client , ctx ):
7076 resp = await app_client .get ("/search" , params = {"ids" : ["test-item" ]})
7177 assert resp .status_code == 200
@@ -77,6 +83,7 @@ async def test_app_search_response(app_client, ctx):
7783 assert resp_json .get ("stac_extensions" ) is None
7884
7985
86+ @pytest .mark .asyncio
8087async def test_app_context_extension (app_client , ctx , txn_client ):
8188 test_item = ctx .item
8289 test_item ["id" ] = "test-item-2"
@@ -110,13 +117,15 @@ async def test_app_context_extension(app_client, ctx, txn_client):
110117 assert matched == 1
111118
112119
120+ @pytest .mark .asyncio
113121async def test_app_fields_extension (app_client , ctx , txn_client ):
114122 resp = await app_client .get ("/search" , params = {"collections" : ["test-collection" ]})
115123 assert resp .status_code == 200
116124 resp_json = resp .json ()
117125 assert list (resp_json ["features" ][0 ]["properties" ]) == ["datetime" ]
118126
119127
128+ @pytest .mark .asyncio
120129async def test_app_fields_extension_query (app_client , ctx , txn_client ):
121130 resp = await app_client .post (
122131 "/search" ,
@@ -130,6 +139,7 @@ async def test_app_fields_extension_query(app_client, ctx, txn_client):
130139 assert list (resp_json ["features" ][0 ]["properties" ]) == ["datetime" , "proj:epsg" ]
131140
132141
142+ @pytest .mark .asyncio
133143async def test_app_fields_extension_no_properties_get (app_client , ctx , txn_client ):
134144 resp = await app_client .get (
135145 "/search" , params = {"collections" : ["test-collection" ], "fields" : "-properties" }
@@ -139,6 +149,7 @@ async def test_app_fields_extension_no_properties_get(app_client, ctx, txn_clien
139149 assert "properties" not in resp_json ["features" ][0 ]
140150
141151
152+ @pytest .mark .asyncio
142153async def test_app_fields_extension_no_properties_post (app_client , ctx , txn_client ):
143154 resp = await app_client .post (
144155 "/search" ,
@@ -152,6 +163,7 @@ async def test_app_fields_extension_no_properties_post(app_client, ctx, txn_clie
152163 assert "properties" not in resp_json ["features" ][0 ]
153164
154165
166+ @pytest .mark .asyncio
155167async def test_app_fields_extension_return_all_properties (app_client , ctx , txn_client ):
156168 item = ctx .item
157169 resp = await app_client .get (
@@ -168,6 +180,7 @@ async def test_app_fields_extension_return_all_properties(app_client, ctx, txn_c
168180 assert feature ["properties" ][expected_prop ] == expected_value
169181
170182
183+ @pytest .mark .asyncio
171184async def test_app_query_extension_gt (app_client , ctx ):
172185 params = {"query" : {"proj:epsg" : {"gt" : ctx .item ["properties" ]["proj:epsg" ]}}}
173186 resp = await app_client .post ("/search" , json = params )
@@ -176,6 +189,7 @@ async def test_app_query_extension_gt(app_client, ctx):
176189 assert len (resp_json ["features" ]) == 0
177190
178191
192+ @pytest .mark .asyncio
179193async def test_app_query_extension_gte (app_client , ctx ):
180194 params = {"query" : {"proj:epsg" : {"gte" : ctx .item ["properties" ]["proj:epsg" ]}}}
181195 resp = await app_client .post ("/search" , json = params )
@@ -184,22 +198,26 @@ async def test_app_query_extension_gte(app_client, ctx):
184198 assert len (resp .json ()["features" ]) == 1
185199
186200
201+ @pytest .mark .asyncio
187202async def test_app_query_extension_limit_lt0 (app_client ):
188203 assert (await app_client .post ("/search" , json = {"limit" : - 1 })).status_code == 400
189204
190205
206+ @pytest .mark .asyncio
191207async def test_app_query_extension_limit_gt10000 (app_client ):
192208 resp = await app_client .post ("/search" , json = {"limit" : 10001 })
193209 assert resp .status_code == 200
194210 assert resp .json ()["context" ]["limit" ] == 10000
195211
196212
213+ @pytest .mark .asyncio
197214async def test_app_query_extension_limit_10000 (app_client ):
198215 params = {"limit" : 10000 }
199216 resp = await app_client .post ("/search" , json = params )
200217 assert resp .status_code == 200
201218
202219
220+ @pytest .mark .asyncio
203221async def test_app_sort_extension (app_client , txn_client , ctx ):
204222 first_item = ctx .item
205223 item_date = datetime .strptime (
@@ -225,6 +243,7 @@ async def test_app_sort_extension(app_client, txn_client, ctx):
225243 assert resp_json ["features" ][1 ]["id" ] == second_item ["id" ]
226244
227245
246+ @pytest .mark .asyncio
228247async def test_search_invalid_date (app_client , ctx ):
229248 params = {
230249 "datetime" : "2020-XX-01/2020-10-30" ,
@@ -272,6 +291,7 @@ async def test_search_point_intersects_post(app_client, ctx):
272291 assert len (resp_json ["features" ]) == 1
273292
274293
294+ @pytest .mark .asyncio
275295async def test_search_point_does_not_intersect (app_client , ctx ):
276296 point = [15.04 , - 3.14 ]
277297 intersects = {"type" : "Point" , "coordinates" : point }
@@ -287,6 +307,7 @@ async def test_search_point_does_not_intersect(app_client, ctx):
287307 assert len (resp_json ["features" ]) == 0
288308
289309
310+ @pytest .mark .asyncio
290311async def test_datetime_non_interval (app_client , ctx ):
291312 dt_formats = [
292313 "2020-02-12T12:30:22+00:00" ,
@@ -308,6 +329,7 @@ async def test_datetime_non_interval(app_client, ctx):
308329 assert resp_json ["features" ][0 ]["properties" ]["datetime" ][0 :19 ] == dt [0 :19 ]
309330
310331
332+ @pytest .mark .asyncio
311333async def test_bbox_3d (app_client , ctx ):
312334 australia_bbox = [106.343365 , - 47.199523 , 0.1 , 168.218365 , - 19.437288 , 0.1 ]
313335 params = {
@@ -320,6 +342,7 @@ async def test_bbox_3d(app_client, ctx):
320342 assert len (resp_json ["features" ]) == 1
321343
322344
345+ @pytest .mark .asyncio
323346async def test_search_line_string_intersects (app_client , ctx ):
324347 line = [[150.04 , - 33.14 ], [150.22 , - 33.89 ]]
325348 intersects = {"type" : "LineString" , "coordinates" : line }
0 commit comments