feat: add PATCH /projects/{id} for partial updates

- Added PATCH endpoint for projects (supports name and/or description)
- Added test_patch_project test case
- Verify folder_id already supported in POST /api/v1/projects/{project_id}/documents
This commit is contained in:
Motoko
2026-03-31 00:16:27 +00:00
parent d3a2194c86
commit 02292523ff
2 changed files with 64 additions and 0 deletions

View File

@@ -62,6 +62,40 @@ async def test_update_project(client):
assert response.json()["name"] == "Updated"
@pytest.mark.asyncio
async def test_patch_project(client):
"""Test PATCH endpoint for partial project update."""
token = await get_token(client)
create_resp = await client.post(
"/api/v1/projects",
json={"name": "Original", "description": "Original desc"},
headers={"Authorization": f"Bearer {token}"}
)
proj_id = create_resp.json()["id"]
# PATCH name only
response = await client.patch(
f"/api/v1/projects/{proj_id}",
json={"name": "Patched Name"},
headers={"Authorization": f"Bearer {token}"}
)
assert response.status_code == 200
data = response.json()
assert data["name"] == "Patched Name"
assert data["description"] == "Original desc"
# PATCH description only
response = await client.patch(
f"/api/v1/projects/{proj_id}",
json={"description": "Patched desc"},
headers={"Authorization": f"Bearer {token}"}
)
assert response.status_code == 200
data = response.json()
assert data["name"] == "Patched Name"
assert data["description"] == "Patched desc"
@pytest.mark.asyncio
async def test_soft_delete_project(client):
token = await get_token(client)