Skip to content

Commit 8de5b08

Browse files
committed
update for PUT collection/{collection_id}
1 parent bf5eca1 commit 8de5b08

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

stac_fastapi/tests/resources/test_collection.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ async def test_delete_missing_collection(app_client):
5555
async def test_update_collection_already_exists(ctx, app_client):
5656
"""Test updating a collection which already exists"""
5757
ctx.collection["keywords"].append("test")
58-
resp = await app_client.put("/collections", json=ctx.collection)
58+
resp = await app_client.put(
59+
"/collections/{ctx.collection['id']}", json=ctx.collection
60+
)
5961
assert resp.status_code == 200
6062

6163
resp = await app_client.get(f"/collections/{ctx.collection['id']}")
@@ -70,7 +72,9 @@ async def test_update_new_collection(app_client, load_test_data):
7072
test_collection = load_test_data("test_collection.json")
7173
test_collection["id"] = "new-test-collection"
7274

73-
resp = await app_client.put("/collections", json=test_collection)
75+
resp = await app_client.put(
76+
"/collections/{ctx.collection['id']}", json=test_collection
77+
)
7478
assert resp.status_code == 404
7579

7680

@@ -84,7 +88,9 @@ async def test_collection_not_found(app_client):
8488
@pytest.mark.asyncio
8589
async def test_returns_valid_collection(ctx, app_client):
8690
"""Test validates fetched collection with jsonschema"""
87-
resp = await app_client.put("/collections", json=ctx.collection)
91+
resp = await app_client.put(
92+
"/collections/{ctx.collection['id']}", json=ctx.collection
93+
)
8894
assert resp.status_code == 200
8995

9096
resp = await app_client.get(f"/collections/{ctx.collection['id']}")
@@ -109,7 +115,9 @@ async def test_collection_extensions(ctx, app_client):
109115
)
110116
test_asset = {"title": "test", "description": "test", "type": "test"}
111117
ctx.collection["item_assets"] = {"test": test_asset}
112-
resp = await app_client.put("/collections", json=ctx.collection)
118+
resp = await app_client.put(
119+
"/collections/{ctx.collection['id']}", json=ctx.collection
120+
)
113121

114122
assert resp.status_code == 200
115123
assert resp.json().get("item_assets", {}).get("test") == test_asset

0 commit comments

Comments
 (0)