feat: add scratchpad field to session model and schemas
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -315,3 +315,51 @@ class TestSessions:
|
||||
data = response.json()
|
||||
assert len(data) >= 1
|
||||
assert all(s["completed_at"] is None for s in data)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_create_session_has_scratchpad(
|
||||
self, client: AsyncClient, auth_headers: dict, test_tree: dict
|
||||
):
|
||||
"""Test that new sessions include scratchpad field."""
|
||||
session_data = {
|
||||
"tree_id": test_tree["id"],
|
||||
}
|
||||
|
||||
response = await client.post(
|
||||
"/api/v1/sessions",
|
||||
json=session_data,
|
||||
headers=auth_headers
|
||||
)
|
||||
|
||||
assert response.status_code == 201
|
||||
data = response.json()
|
||||
assert "scratchpad" in data
|
||||
assert data["scratchpad"] == ""
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_update_scratchpad_via_put(
|
||||
self, client: AsyncClient, auth_headers: dict, test_tree: dict
|
||||
):
|
||||
"""Test updating scratchpad through the existing PUT endpoint."""
|
||||
# Create session
|
||||
create_response = await client.post(
|
||||
"/api/v1/sessions",
|
||||
json={"tree_id": test_tree["id"]},
|
||||
headers=auth_headers
|
||||
)
|
||||
session_id = create_response.json()["id"]
|
||||
|
||||
# Update scratchpad via PUT
|
||||
update_data = {
|
||||
"scratchpad": "- Server IP: 192.168.1.50\n- Error: 0x80070005"
|
||||
}
|
||||
|
||||
response = await client.put(
|
||||
f"/api/v1/sessions/{session_id}",
|
||||
json=update_data,
|
||||
headers=auth_headers
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["scratchpad"] == update_data["scratchpad"]
|
||||
|
||||
Reference in New Issue
Block a user