Skip to content

Commit

Permalink
update for PUT collection/{collection_id}
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhealy1 committed Apr 18, 2024
1 parent bf5eca1 commit 8de5b08
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions stac_fastapi/tests/resources/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ async def test_delete_missing_collection(app_client):
async def test_update_collection_already_exists(ctx, app_client):
"""Test updating a collection which already exists"""
ctx.collection["keywords"].append("test")
resp = await app_client.put("/collections", json=ctx.collection)
resp = await app_client.put(
"/collections/{ctx.collection['id']}", json=ctx.collection
)
assert resp.status_code == 200

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

resp = await app_client.put("/collections", json=test_collection)
resp = await app_client.put(
"/collections/{ctx.collection['id']}", json=test_collection
)
assert resp.status_code == 404


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

resp = await app_client.get(f"/collections/{ctx.collection['id']}")
Expand All @@ -109,7 +115,9 @@ async def test_collection_extensions(ctx, app_client):
)
test_asset = {"title": "test", "description": "test", "type": "test"}
ctx.collection["item_assets"] = {"test": test_asset}
resp = await app_client.put("/collections", json=ctx.collection)
resp = await app_client.put(
"/collections/{ctx.collection['id']}", json=ctx.collection
)

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

0 comments on commit 8de5b08

Please sign in to comment.