Skip to content

Commit f93bc3b

Browse files
committed
Fix tests.
1 parent b0ecbca commit f93bc3b

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

stac_fastapi/tests/api/test_api.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -621,23 +621,19 @@ async def test_bbox_3d(app_client, ctx):
621621
@pytest.mark.asyncio
622622
async def test_patch_json_collection(app_client, ctx):
623623
data = {
624-
"id": "new_id",
625624
"summaries": {"hello": "world", "gsd": [50], "instruments": None},
626625
}
627626

628627
resp = await app_client.patch(f"/collections/{ctx.collection['id']}", json=data)
629628

630629
assert resp.status_code == 200
631630

632-
new_resp = await app_client.get("/collections/new_id")
633-
old_resp = await app_client.get(f"/collections/{ctx.collection['id']}")
631+
new_resp = await app_client.get(f"/collections/{ctx.collection['id']}")
634632

635633
assert new_resp.status_code == 200
636-
assert old_resp.status_code == 404
637634

638635
new_resp_json = new_resp.json()
639636

640-
assert new_resp_json["id"] == "new_id"
641637
assert new_resp_json["summaries"]["hello"] == "world"
642638
assert "instruments" not in new_resp_json["summaries"]
643639
assert new_resp_json["summaries"]["gsd"] == [50]
@@ -686,7 +682,6 @@ async def test_patch_operations_collection(app_client, ctx):
686682
async def test_patch_json_item(app_client, ctx):
687683

688684
data = {
689-
"id": "new_id",
690685
"properties": {"hello": "world", "proj:epsg": 1000, "landsat:column": None},
691686
}
692687

@@ -696,17 +691,14 @@ async def test_patch_json_item(app_client, ctx):
696691

697692
assert resp.status_code == 200
698693

699-
new_resp = await app_client.get(f"/collections/{ctx.item['collection']}/new_id")
700-
old_resp = await app_client.get(
694+
new_resp = await app_client.get(
701695
f"/collections/{ctx.item['collection']}/{ctx.item['id']}"
702696
)
703697

704698
assert new_resp.status_code == 200
705-
assert old_resp.status_code == 404
706699

707700
new_resp_json = new_resp.json()
708701

709-
assert new_resp_json["id"] == "new_id"
710702
assert new_resp_json["properties"]["hello"] == "world"
711703
assert "landsat:column" not in new_resp_json["properties"]
712704
assert new_resp_json["properties"]["proj:epsg"] == 1000

stac_fastapi/tests/clients/test_es_os.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,8 @@ async def test_json_patch_item_add(ctx, core_client, txn_client):
316316

317317
assert updated_item["properties"]["foo"] == "bar"
318318
assert updated_item["properties"]["ext:hello"] == "world"
319-
assert (
320-
len(updated_item["properties"]["eo:bands"])
321-
== len(ctx.item["properties"]["eo:bands"]) + 1
319+
assert len(updated_item["properties"]["eo:bands"]) == len(
320+
ctx.item["properties"]["eo:bands"] + 1
322321
)
323322
assert updated_item["properties"]["eo:bands"][1] == {
324323
"gsd": 10,
@@ -503,9 +502,8 @@ async def test_json_patch_item_copy(ctx, core_client, txn_client):
503502

504503
assert updated_item["properties"]["foo"] == updated_item["properties"]["gsd"]
505504
assert updated_item["properties"]["bar"] == updated_item["properties"]["proj:epsg"]
506-
assert (
507-
len(updated_item["properties"]["eo:bands"])
508-
== len(ctx.item["properties"]["eo:bands"]) + 1
505+
assert len(updated_item["properties"]["eo:bands"]) == len(
506+
ctx.item["properties"]["eo:bands"]
509507
)
510508
assert (
511509
updated_item["properties"]["eo:bands"][0]

0 commit comments

Comments
 (0)