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) <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user