Skip to content

Commit 7b84e8d

Browse files
author
Phil Varner
committed
fix tests since matched may not appear in results now
1 parent 9f814d2 commit 7b84e8d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

stac_fastapi/elasticsearch/tests/api/test_api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ async def test_app_context_extension(app_client, ctx, txn_client):
103103
resp_json = resp.json()
104104
assert len(resp_json["features"]) == 1
105105
assert "context" in resp_json
106-
assert resp_json["context"]["returned"] == resp_json["context"]["matched"] == 1
106+
assert resp_json["context"]["returned"] == 1
107+
if matched := resp_json["context"].get("matched"):
108+
assert matched == 1
107109

108110

109111
@pytest.mark.skip(reason="fields not implemented yet")

stac_fastapi/elasticsearch/tests/resources/test_item.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ async def test_get_item_collection(app_client, ctx, txn_client):
184184
assert resp.status_code == 200
185185

186186
item_collection = resp.json()
187-
assert item_collection["context"]["matched"] == item_count + 1
187+
if matched := item_collection["context"].get("matched"):
188+
assert matched == item_count + 1
188189

189190

190191
@pytest.mark.skip(reason="Pagination extension not implemented")

0 commit comments

Comments
 (0)