@@ -72,19 +72,19 @@ async def test_get_queryables_content_type(app_client, load_test_collection):
7272 assert resp .headers ["content-type" ] == "application/schema+json"
7373
7474 coll = load_test_collection
75- resp = await app_client .get (f"collections/{ coll . id } /queryables" )
75+ resp = await app_client .get (f"collections/{ coll [ 'id' ] } /queryables" )
7676 assert resp .headers ["content-type" ] == "application/schema+json"
7777
7878
7979async def test_get_features_content_type (app_client , load_test_collection ):
8080 coll = load_test_collection
81- resp = await app_client .get (f"collections/{ coll . id } /items" )
81+ resp = await app_client .get (f"collections/{ coll [ 'id' ] } /items" )
8282 assert resp .headers ["content-type" ] == "application/geo+json"
8383
8484
8585async def test_get_features_self_link (app_client , load_test_collection ):
8686 # https://github.com/stac-utils/stac-fastapi/issues/483
87- resp = await app_client .get (f"collections/{ load_test_collection . id } /items" )
87+ resp = await app_client .get (f"collections/{ load_test_collection [ 'id' ] } /items" )
8888 assert resp .status_code == 200
8989 resp_json = resp .json ()
9090 self_link = next ((link for link in resp_json ["links" ] if link ["rel" ] == "self" ), None )
@@ -94,7 +94,7 @@ async def test_get_features_self_link(app_client, load_test_collection):
9494
9595async def test_get_feature_content_type (app_client , load_test_collection , load_test_item ):
9696 resp = await app_client .get (
97- f"collections/{ load_test_collection . id } /items/{ load_test_item . id } "
97+ f"collections/{ load_test_collection [ 'id' ] } /items/{ load_test_item [ 'id' ] } "
9898 )
9999 assert resp .headers ["content-type" ] == "application/geo+json"
100100
@@ -141,14 +141,14 @@ async def test_app_transaction_extension(
141141):
142142 coll = load_test_collection
143143 item = load_test_data ("test_item.json" )
144- resp = await app_client .post (f"/collections/{ coll . id } /items" , json = item )
144+ resp = await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = item )
145145 assert resp .status_code == 201
146146
147147
148148async def test_app_query_extension (load_test_data , app_client , load_test_collection ):
149149 coll = load_test_collection
150150 item = load_test_data ("test_item.json" )
151- resp = await app_client .post (f"/collections/{ coll . id } /items" , json = item )
151+ resp = await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = item )
152152 assert resp .status_code == 201
153153
154154 params = {"query" : {"proj:epsg" : {"eq" : item ["properties" ]["proj:epsg" ]}}}
@@ -169,7 +169,7 @@ async def test_app_query_extension_limit_1(
169169):
170170 coll = load_test_collection
171171 item = load_test_data ("test_item.json" )
172- resp = await app_client .post (f"/collections/{ coll . id } /items" , json = item )
172+ resp = await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = item )
173173 assert resp .status_code == 201
174174
175175 params = {"limit" : 1 }
@@ -190,7 +190,7 @@ async def test_app_query_extension_limit_lt0(
190190):
191191 coll = load_test_collection
192192 item = load_test_data ("test_item.json" )
193- resp = await app_client .post (f"/collections/{ coll . id } /items" , json = item )
193+ resp = await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = item )
194194 assert resp .status_code == 201
195195
196196 params = {"limit" : - 1 }
@@ -203,7 +203,7 @@ async def test_app_query_extension_limit_gt10000(
203203):
204204 coll = load_test_collection
205205 item = load_test_data ("test_item.json" )
206- resp = await app_client .post (f"/collections/{ coll . id } /items" , json = item )
206+ resp = await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = item )
207207 assert resp .status_code == 201
208208
209209 params = {"limit" : 10001 }
@@ -214,7 +214,7 @@ async def test_app_query_extension_limit_gt10000(
214214async def test_app_query_extension_gt (load_test_data , app_client , load_test_collection ):
215215 coll = load_test_collection
216216 item = load_test_data ("test_item.json" )
217- resp = await app_client .post (f"/collections/{ coll . id } /items" , json = item )
217+ resp = await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = item )
218218 assert resp .status_code == 201
219219
220220 params = {"query" : {"proj:epsg" : {"gt" : item ["properties" ]["proj:epsg" ]}}}
@@ -227,7 +227,7 @@ async def test_app_query_extension_gt(load_test_data, app_client, load_test_coll
227227async def test_app_query_extension_gte (load_test_data , app_client , load_test_collection ):
228228 coll = load_test_collection
229229 item = load_test_data ("test_item.json" )
230- resp = await app_client .post (f"/collections/{ coll . id } /items" , json = item )
230+ resp = await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = item )
231231 assert resp .status_code == 201
232232
233233 params = {"query" : {"proj:epsg" : {"gte" : item ["properties" ]["proj:epsg" ]}}}
@@ -243,7 +243,7 @@ async def test_app_sort_extension(load_test_data, app_client, load_test_collecti
243243 item_date = datetime .strptime (
244244 first_item ["properties" ]["datetime" ], "%Y-%m-%dT%H:%M:%SZ"
245245 )
246- resp = await app_client .post (f"/collections/{ coll . id } /items" , json = first_item )
246+ resp = await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = first_item )
247247 assert resp .status_code == 201
248248
249249 second_item = load_test_data ("test_item.json" )
@@ -252,11 +252,11 @@ async def test_app_sort_extension(load_test_data, app_client, load_test_collecti
252252 second_item ["properties" ]["datetime" ] = another_item_date .strftime (
253253 "%Y-%m-%dT%H:%M:%SZ"
254254 )
255- resp = await app_client .post (f"/collections/{ coll . id } /items" , json = second_item )
255+ resp = await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = second_item )
256256 assert resp .status_code == 201
257257
258258 params = {
259- "collections" : [coll . id ],
259+ "collections" : [coll [ "id" ] ],
260260 "sortby" : [{"field" : "datetime" , "direction" : "desc" }],
261261 }
262262
@@ -267,7 +267,7 @@ async def test_app_sort_extension(load_test_data, app_client, load_test_collecti
267267 assert resp_json ["features" ][1 ]["id" ] == second_item ["id" ]
268268
269269 params = {
270- "collections" : [coll . id ],
270+ "collections" : [coll [ "id" ] ],
271271 "sortby" : [{"field" : "datetime" , "direction" : "asc" }],
272272 }
273273 resp = await app_client .post ("/search" , json = params )
@@ -280,12 +280,12 @@ async def test_app_sort_extension(load_test_data, app_client, load_test_collecti
280280async def test_search_invalid_date (load_test_data , app_client , load_test_collection ):
281281 coll = load_test_collection
282282 first_item = load_test_data ("test_item.json" )
283- resp = await app_client .post (f"/collections/{ coll . id } /items" , json = first_item )
283+ resp = await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = first_item )
284284 assert resp .status_code == 201
285285
286286 params = {
287287 "datetime" : "2020-XX-01/2020-10-30" ,
288- "collections" : [coll . id ],
288+ "collections" : [coll [ "id" ] ],
289289 }
290290
291291 resp = await app_client .post ("/search" , json = params )
@@ -295,13 +295,13 @@ async def test_search_invalid_date(load_test_data, app_client, load_test_collect
295295async def test_bbox_3d (load_test_data , app_client , load_test_collection ):
296296 coll = load_test_collection
297297 first_item = load_test_data ("test_item.json" )
298- resp = await app_client .post (f"/collections/{ coll . id } /items" , json = first_item )
298+ resp = await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = first_item )
299299 assert resp .status_code == 201
300300
301301 australia_bbox = [106.343365 , - 47.199523 , 0.1 , 168.218365 , - 19.437288 , 0.1 ]
302302 params = {
303303 "bbox" : australia_bbox ,
304- "collections" : [coll . id ],
304+ "collections" : [coll [ "id" ] ],
305305 }
306306 resp = await app_client .post ("/search" , json = params )
307307 assert resp .status_code == 200
@@ -313,7 +313,7 @@ async def test_bbox_3d(load_test_data, app_client, load_test_collection):
313313async def test_app_search_response (load_test_data , app_client , load_test_collection ):
314314 coll = load_test_collection
315315 params = {
316- "collections" : [coll . id ],
316+ "collections" : [coll [ "id" ] ],
317317 }
318318 resp = await app_client .post ("/search" , json = params )
319319 assert resp .status_code == 200
@@ -328,7 +328,7 @@ async def test_app_search_response(load_test_data, app_client, load_test_collect
328328async def test_search_point_intersects (load_test_data , app_client , load_test_collection ):
329329 coll = load_test_collection
330330 item = load_test_data ("test_item.json" )
331- resp = await app_client .post (f"/collections/{ coll . id } /items" , json = item )
331+ resp = await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = item )
332332 assert resp .status_code == 201
333333
334334 new_coordinates = []
@@ -337,7 +337,7 @@ async def test_search_point_intersects(load_test_data, app_client, load_test_col
337337 item ["id" ] = "test-item-other-hemispheres"
338338 item ["geometry" ]["coordinates" ] = [new_coordinates ]
339339 item ["bbox" ] = [value * - 1 for value in item ["bbox" ]]
340- resp = await app_client .post (f"/collections/{ coll . id } /items" , json = item )
340+ resp = await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = item )
341341 assert resp .status_code == 201
342342
343343 point = [150.04 , - 33.14 ]
@@ -364,7 +364,7 @@ async def test_search_line_string_intersects(
364364):
365365 coll = load_test_collection
366366 item = load_test_data ("test_item.json" )
367- resp = await app_client .post (f"/collections/{ coll . id } /items" , json = item )
367+ resp = await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = item )
368368 assert resp .status_code == 201
369369
370370 line = [[150.04 , - 33.14 ], [150.22 , - 33.89 ]]
@@ -384,7 +384,7 @@ async def test_search_line_string_intersects(
384384async def test_landing_forwarded_header (load_test_data , app_client , load_test_collection ):
385385 coll = load_test_collection
386386 item = load_test_data ("test_item.json" )
387- await app_client .post (f"/collections/{ coll . id } /items" , json = item )
387+ await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = item )
388388 response = (
389389 await app_client .get (
390390 "/" ,
@@ -403,7 +403,7 @@ async def test_landing_forwarded_header(load_test_data, app_client, load_test_co
403403async def test_search_forwarded_header (load_test_data , app_client , load_test_collection ):
404404 coll = load_test_collection
405405 item = load_test_data ("test_item.json" )
406- await app_client .post (f"/collections/{ coll . id } /items" , json = item )
406+ await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = item )
407407 resp = await app_client .post (
408408 "/search" ,
409409 json = {
@@ -424,7 +424,7 @@ async def test_search_x_forwarded_headers(
424424):
425425 coll = load_test_collection
426426 item = load_test_data ("test_item.json" )
427- await app_client .post (f"/collections/{ coll . id } /items" , json = item )
427+ await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = item )
428428 resp = await app_client .post (
429429 "/search" ,
430430 json = {
@@ -448,7 +448,7 @@ async def test_search_duplicate_forward_headers(
448448):
449449 coll = load_test_collection
450450 item = load_test_data ("test_item.json" )
451- await app_client .post (f"/collections/{ coll . id } /items" , json = item )
451+ await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = item )
452452 resp = await app_client .post (
453453 "/search" ,
454454 json = {
@@ -495,17 +495,17 @@ async def test_item_collection_filter_bbox(
495495):
496496 coll = load_test_collection
497497 first_item = load_test_data ("test_item.json" )
498- resp = await app_client .post (f"/collections/{ coll . id } /items" , json = first_item )
498+ resp = await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = first_item )
499499 assert resp .status_code == 201
500500
501501 bbox = "100,-50,170,-20"
502- resp = await app_client .get (f"/collections/{ coll . id } /items" , params = {"bbox" : bbox })
502+ resp = await app_client .get (f"/collections/{ coll [ 'id' ] } /items" , params = {"bbox" : bbox })
503503 assert resp .status_code == 200
504504 resp_json = resp .json ()
505505 assert len (resp_json ["features" ]) == 1
506506
507507 bbox = "1,2,3,4"
508- resp = await app_client .get (f"/collections/{ coll . id } /items" , params = {"bbox" : bbox })
508+ resp = await app_client .get (f"/collections/{ coll [ 'id' ] } /items" , params = {"bbox" : bbox })
509509 assert resp .status_code == 200
510510 resp_json = resp .json ()
511511 assert len (resp_json ["features" ]) == 0
@@ -517,20 +517,20 @@ async def test_item_collection_filter_datetime(
517517):
518518 coll = load_test_collection
519519 first_item = load_test_data ("test_item.json" )
520- resp = await app_client .post (f"/collections/{ coll . id } /items" , json = first_item )
520+ resp = await app_client .post (f"/collections/{ coll [ 'id' ] } /items" , json = first_item )
521521 assert resp .status_code == 201
522522
523523 datetime_range = "2020-01-01T00:00:00.00Z/.."
524524 resp = await app_client .get (
525- f"/collections/{ coll . id } /items" , params = {"datetime" : datetime_range }
525+ f"/collections/{ coll [ 'id' ] } /items" , params = {"datetime" : datetime_range }
526526 )
527527 assert resp .status_code == 200
528528 resp_json = resp .json ()
529529 assert len (resp_json ["features" ]) == 1
530530
531531 datetime_range = "2018-01-01T00:00:00.00Z/2019-01-01T00:00:00.00Z"
532532 resp = await app_client .get (
533- f"/collections/{ coll . id } /items" , params = {"datetime" : datetime_range }
533+ f"/collections/{ coll [ 'id' ] } /items" , params = {"datetime" : datetime_range }
534534 )
535535 assert resp .status_code == 200
536536 resp_json = resp .json ()
@@ -577,7 +577,7 @@ async def test_deleting_items_with_identical_ids(app_client):
577577
578578@pytest .mark .parametrize ("direction" , ("asc" , "desc" ))
579579async def test_sorting_and_paging (app_client , load_test_collection , direction : str ):
580- collection_id = load_test_collection . id
580+ collection_id = load_test_collection [ "id" ]
581581 for i in range (10 ):
582582 item = Item (
583583 id = f"item-{ i } " ,
0 commit comments