test: 更新 AgentScope 相关单元测试与集成测试

- 重命名 test_react_runner.py 为 test_runner.py
- 新增 test_utils.py 测试工具函数
- 更新现有测试用例适配新架构
This commit is contained in:
qzl
2026-03-16 16:11:06 +08:00
parent 36b104fa37
commit e55f12cdc1
15 changed files with 753 additions and 717 deletions
@@ -64,14 +64,11 @@ class _FakeAgentService:
) -> dict[str, object]:
del current_user, before
return {
"type": "STATE_SNAPSHOT",
"threadId": thread_id or "00000000-0000-0000-0000-000000000001",
"snapshot": {
"scope": "history_day",
"day": "2026-03-07",
"hasMore": False,
"messages": [],
},
"scope": "history_day",
"day": "2026-03-07",
"hasMore": False,
"messages": [],
}
async def upload_attachment(
@@ -277,10 +274,9 @@ def test_history_returns_state_snapshot() -> None:
)
assert authorized.status_code == 200
payload = authorized.json()
assert payload["type"] == "STATE_SNAPSHOT"
assert payload["scope"] == "history_day"
assert payload["threadId"] == "00000000-0000-0000-0000-000000000001"
assert payload["snapshot"]["scope"] == "history_day"
assert payload["snapshot"]["day"] == "2026-03-07"
assert payload["day"] == "2026-03-07"
finally:
app.dependency_overrides = {}
@@ -295,7 +291,7 @@ def test_user_history_returns_latest_snapshot() -> None:
response = client.get("/api/v1/agent/history")
assert response.status_code == 200
body = response.json()
assert body["type"] == "STATE_SNAPSHOT"
assert body["scope"] == "history_day"
assert body["threadId"] == "00000000-0000-0000-0000-000000000001"
finally:
app.dependency_overrides = {}