Skip to content

Commit ac85258

Browse files
committed
add test for collection extensions
1 parent 0cad96c commit ac85258

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

stac_fastapi/elasticsearch/tests/resources/test_collection.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,20 @@ async def test_returns_valid_collection(ctx, app_client):
8484
collection.validate()
8585

8686

87+
@pytest.mark.asyncio
88+
async def test_collection_extensions(ctx, app_client):
89+
"""Test that extensions can be used to define additional top-level properties"""
90+
ctx.collection.get("stac_extensions", []).append(
91+
"https://stac-extensions.github.io/item-assets/v1.0.0/schema.json"
92+
)
93+
test_asset = {"title": "test", "description": "test", "type": "test"}
94+
ctx.collection["item_assets"] = {"test": test_asset}
95+
resp = await app_client.put("/collections", json=ctx.collection)
96+
97+
assert resp.status_code == 200
98+
assert resp.json().get("item_assets", {}).get("test") == test_asset
99+
100+
87101
@pytest.mark.asyncio
88102
async def test_pagination_collection(app_client, ctx, txn_client):
89103
"""Test collection pagination links"""

0 commit comments

Comments
 (0)