@@ -415,3 +415,51 @@ async def test_collection_queryables(load_test_data, app_client, load_test_colle
415
415
assert "properties" in q
416
416
assert "id" in q ["properties" ]
417
417
assert "eo:cloud_cover" in q ["properties" ]
418
+
419
+
420
+ @pytest .mark .asyncio
421
+ async def test_item_collection_filter_bbox (
422
+ load_test_data , app_client , load_test_collection
423
+ ):
424
+ coll = load_test_collection
425
+ first_item = load_test_data ("test_item.json" )
426
+ resp = await app_client .post (f"/collections/{ coll .id } /items" , json = first_item )
427
+ assert resp .status_code == 200
428
+
429
+ bbox = "100,-50,170,-20"
430
+ resp = await app_client .get (f"/collections/{ coll .id } /items" , params = {"bbox" : bbox })
431
+ assert resp .status_code == 200
432
+ resp_json = resp .json ()
433
+ assert len (resp_json ["features" ]) == 1
434
+
435
+ bbox = "1,2,3,4"
436
+ resp = await app_client .get (f"/collections/{ coll .id } /items" , params = {"bbox" : bbox })
437
+ assert resp .status_code == 200
438
+ resp_json = resp .json ()
439
+ assert len (resp_json ["features" ]) == 0
440
+
441
+
442
+ @pytest .mark .asyncio
443
+ async def test_item_collection_filter_datetime (
444
+ load_test_data , app_client , load_test_collection
445
+ ):
446
+ coll = load_test_collection
447
+ first_item = load_test_data ("test_item.json" )
448
+ resp = await app_client .post (f"/collections/{ coll .id } /items" , json = first_item )
449
+ assert resp .status_code == 200
450
+
451
+ datetime_range = "2020-01-01T00:00:00.00Z/.."
452
+ resp = await app_client .get (
453
+ f"/collections/{ coll .id } /items" , params = {"datetime" : datetime_range }
454
+ )
455
+ assert resp .status_code == 200
456
+ resp_json = resp .json ()
457
+ assert len (resp_json ["features" ]) == 1
458
+
459
+ datetime_range = "2018-01-01T00:00:00.00Z/2019-01-01T00:00:00.00Z"
460
+ resp = await app_client .get (
461
+ f"/collections/{ coll .id } /items" , params = {"datetime" : datetime_range }
462
+ )
463
+ assert resp .status_code == 200
464
+ resp_json = resp .json ()
465
+ assert len (resp_json ["features" ]) == 0
0 commit comments