refactor: extract PROCEDURAL_TREE_TYPES constant and add negative tree_type test

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-02-17 10:54:39 -05:00
parent d75e6f78e1
commit 36e1335a00
2 changed files with 25 additions and 2 deletions

View File

@@ -50,3 +50,24 @@ async def test_list_maintenance_trees_filter(client: AsyncClient, auth_headers:
trees = resp.json()
assert all(t["tree_type"] == "maintenance" for t in trees)
assert len(trees) >= 1
@pytest.mark.asyncio
async def test_invalid_tree_type_rejected(client: AsyncClient, auth_headers: dict):
"""An unrecognized tree_type value is rejected with 422."""
resp = await client.post(
"/api/v1/trees",
json={
"name": "Bad Type",
"tree_type": "garbage",
"tree_structure": {
"steps": [
{"id": "s1", "type": "procedure_step", "title": "Step",
"description": "Do it", "content_type": "action"},
{"id": "end", "type": "procedure_end", "title": "Done"},
]
},
},
headers=auth_headers,
)
assert resp.status_code == 422