|
7 | 7 |
|
8 | 8 | from stac_fastapi.types.errors import ConflictError |
9 | 9 |
|
10 | | -from ..conftest import create_collection, create_item |
| 10 | +from ..conftest import MockRequest, create_collection, create_item |
11 | 11 |
|
12 | 12 | ROUTES = { |
13 | 13 | "GET /_mgmt/ping", |
@@ -625,12 +625,12 @@ async def test_patch_json_collection(app_client, ctx): |
625 | 625 | "summaries": {"hello": "world", "gsd": [50], "instruments": None}, |
626 | 626 | } |
627 | 627 |
|
628 | | - resp = await app_client.patch(f"collections/{ctx.collection['id']}", json=data) |
| 628 | + resp = await app_client.patch(f"/collections/{ctx.collection['id']}", json=data) |
629 | 629 |
|
630 | 630 | assert resp.status_code == 200 |
631 | 631 |
|
632 | | - new_resp = await app_client.get("collections/new_id") |
633 | | - old_resp = await app_client.get(f"collections/{ctx.collection['id']}") |
| 632 | + new_resp = await app_client.get("/collections/new_id") |
| 633 | + old_resp = await app_client.get(f"/collections/{ctx.collection['id']}") |
634 | 634 |
|
635 | 635 | assert new_resp.status_code == 200 |
636 | 636 | assert old_resp.status_code == 404 |
@@ -658,7 +658,9 @@ async def test_patch_operations_collection(app_client, ctx): |
658 | 658 | ] |
659 | 659 |
|
660 | 660 | resp = await app_client.patch( |
661 | | - f"/collections/{ctx.item['collection']}", json=operations |
| 661 | + f"/collections/{ctx.item['collection']}", |
| 662 | + json=operations, |
| 663 | + request=MockRequest(headers={"Content-type": "application/json-patch+json"}), |
662 | 664 | ) |
663 | 665 |
|
664 | 666 | assert resp.status_code == 200 |
@@ -722,18 +724,18 @@ async def test_patch_operations_item(app_client, ctx): |
722 | 724 | ] |
723 | 725 |
|
724 | 726 | resp = await app_client.patch( |
725 | | - f"/collections/{ctx.item['collection']}/{ctx.item['id']}", json=operations |
| 727 | + f"/collections/{ctx.item['collection']}/{ctx.item['id']}", |
| 728 | + json=operations, |
| 729 | + request=MockRequest(headers={"Content-type": "application/json-patch+json"}), |
726 | 730 | ) |
727 | 731 |
|
728 | 732 | assert resp.status_code == 200 |
729 | 733 |
|
730 | | - new_resp = await app_client.get(f"/collections/{ctx.item['collection']}/new_id") |
731 | | - old_resp = await app_client.get( |
| 734 | + new_resp = await app_client.get( |
732 | 735 | f"/collections/{ctx.item['collection']}/{ctx.item['id']}" |
733 | 736 | ) |
734 | 737 |
|
735 | 738 | assert new_resp.status_code == 200 |
736 | | - assert old_resp.status_code == 404 |
737 | 739 |
|
738 | 740 | new_resp_json = new_resp.json() |
739 | 741 |
|
|
0 commit comments