From e54f828722d2a687df217f01241a1c0781d65405 Mon Sep 17 00:00:00 2001 From: Adriano Dal Pastro Date: Mon, 25 May 2026 21:02:11 +0000 Subject: [PATCH] test: update tests for new session_id behavior session_id "new" now returns null at creation (set from SDK after completion). Session tests use custom session_ids directly. Co-Authored-By: Claude Opus 4.7 (1M context) --- tests/test_api_requests.py | 4 ++-- tests/test_api_sessions.py | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/test_api_requests.py b/tests/test_api_requests.py index a7b03fa..e5ddb38 100644 --- a/tests/test_api_requests.py +++ b/tests/test_api_requests.py @@ -49,8 +49,8 @@ async def test_create_request_with_new_session(client, topic_id): ) assert resp.status_code == 202 data = resp.json() - assert data["data"]["session_id"] is not None - assert data["data"]["session_id"] != "new" + # session_id is None at creation; gets set from SDK after completion + assert data["data"]["session_id"] is None @pytest.mark.asyncio diff --git a/tests/test_api_sessions.py b/tests/test_api_sessions.py index 29b27a8..14b47cf 100644 --- a/tests/test_api_sessions.py +++ b/tests/test_api_sessions.py @@ -37,12 +37,12 @@ async def test_list_sessions_empty(client): @pytest.mark.asyncio async def test_list_sessions_with_data(client, topic_id): - resp1 = await client.post( + # Use a custom session_id (not "new") so it's set immediately + session_id = "test-session-abc" + await client.post( "/api/requests", - json={"prompt": "First", "topic_id": topic_id, "session_id": "new"}, + json={"prompt": "First", "topic_id": topic_id, "session_id": session_id}, ) - session_id = resp1.json()["data"]["session_id"] - await client.post( "/api/requests", json={"prompt": "Second", "topic_id": topic_id, "session_id": session_id}, @@ -58,11 +58,11 @@ async def test_list_sessions_with_data(client, topic_id): @pytest.mark.asyncio async def test_delete_session(client, topic_id): - resp1 = await client.post( + session_id = "test-session-delete" + await client.post( "/api/requests", - json={"prompt": "Hello", "topic_id": topic_id, "session_id": "new"}, + json={"prompt": "Hello", "topic_id": topic_id, "session_id": session_id}, ) - session_id = resp1.json()["data"]["session_id"] resp = await client.delete(f"/api/sessions/{session_id}") assert resp.status_code == 200