refactor(api): use typed application state consistently

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-24 13:08:36 +08:00
1 parent a4a733d965
commit 06dd977838
2 files changed
+10 -55

No files matched your search

+3 -18
View File
@@ -262,12 +262,7 @@ async def test_model_mismatch_returns_400() -> None:
"messages": [{"role": "user", "content": "hello"}],
}
)
request.app = {
"agent_loop": _make_mock_agent(),
"model_name": "test-model",
"request_timeout": 10.0,
"session_lock": asyncio.Lock(),
}
request.app = create_app(_make_mock_agent(), model_name="test-model", request_timeout=10.0)
resp = await handle_chat_completions(request)
assert resp.status == 400
@@ -286,12 +281,7 @@ async def test_single_user_message_required() -> None:
],
}
)
request.app = {
"agent_loop": _make_mock_agent(),
"model_name": "test-model",
"request_timeout": 10.0,
"session_lock": asyncio.Lock(),
}
request.app = create_app(_make_mock_agent(), model_name="test-model", request_timeout=10.0)
resp = await handle_chat_completions(request)
assert resp.status == 400
@@ -307,12 +297,7 @@ async def test_single_user_message_must_have_user_role() -> None:
"messages": [{"role": "system", "content": "you are a bot"}],
}
)
request.app = {
"agent_loop": _make_mock_agent(),
"model_name": "test-model",
"request_timeout": 10.0,
"session_lock": asyncio.Lock(),
}
request.app = create_app(_make_mock_agent(), model_name="test-model", request_timeout=10.0)
resp = await handle_chat_completions(request)
assert resp.status == 400