Skip to content

Commit e4b7764

Browse files
committed
use ctx.item id
1 parent 7900427 commit e4b7764

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

stac_fastapi/elasticsearch/tests/resources/test_item.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,15 +651,17 @@ async def test_pagination_token_idempotent(app_client, ctx, txn_client):
651651

652652
async def test_field_extension_get_includes(app_client, ctx):
653653
"""Test GET search with included fields (fields extension)"""
654-
params = {"fields": "+properties.proj:epsg,+properties.gsd"}
654+
test_item = ctx.item
655+
params = {"ids": [test_item["id"]], "fields": "+properties.proj:epsg,+properties.gsd"}
655656
resp = await app_client.get("/search", params=params)
656657
feat_properties = resp.json()["features"][0]["properties"]
657658
assert not set(feat_properties) - {"proj:epsg", "gsd", "datetime"}
658659

659660

660661
async def test_field_extension_get_excludes(app_client, ctx):
661662
"""Test GET search with included fields (fields extension)"""
662-
params = {"fields": "-properties.proj:epsg,-properties.gsd"}
663+
test_item = ctx.item
664+
params = {"ids": [test_item["id"]], "fields": "-properties.proj:epsg,-properties.gsd"}
663665
resp = await app_client.get("/search", params=params)
664666
resp_json = resp.json()
665667
assert "proj:epsg" not in resp_json["features"][0]["properties"].keys()
@@ -668,7 +670,9 @@ async def test_field_extension_get_excludes(app_client, ctx):
668670

669671
async def test_field_extension_post(app_client, ctx):
670672
"""Test POST search with included and excluded fields (fields extension)"""
673+
test_item = ctx.item
671674
body = {
675+
"ids": [test_item["id"]],
672676
"fields": {
673677
"exclude": ["assets.B1"],
674678
"include": ["properties.eo:cloud_cover", "properties.orientation"],
@@ -687,7 +691,9 @@ async def test_field_extension_post(app_client, ctx):
687691

688692
async def test_field_extension_exclude_and_include(app_client, ctx):
689693
"""Test POST search including/excluding same field (fields extension)"""
694+
test_item = ctx.item
690695
body = {
696+
"ids": [test_item["id"]],
691697
"fields": {
692698
"exclude": ["properties.eo:cloud_cover"],
693699
"include": ["properties.eo:cloud_cover"],
@@ -701,7 +707,11 @@ async def test_field_extension_exclude_and_include(app_client, ctx):
701707

702708
async def test_field_extension_exclude_default_includes(app_client, ctx):
703709
"""Test POST search excluding a forbidden field (fields extension)"""
704-
body = {"fields": {"exclude": ["gsd"]}}
710+
test_item = ctx.item
711+
body = {
712+
"ids": [test_item["id"]],
713+
"fields": {"exclude": ["gsd"]}
714+
}
705715

706716
resp = await app_client.post("/search", json=body)
707717
resp_json = resp.json()

0 commit comments

Comments
 (0)