Skip to content

Commit 166619a

Browse files
committed
🧪 add test case
1 parent 9da4062 commit 166619a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

‎test/backend/services/test_agent_service.py‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ async def test_get_agent_info_impl_success(mock_search_agent_info, mock_search_t
269269
main_agent_id=123, tenant_id="test_tenant")
270270

271271

272+
@patch('backend.services.agent_service.get_model_by_model_id')
272273
@patch('backend.services.agent_service.query_sub_agents_id_list')
273274
@patch('backend.services.agent_service.get_enable_tool_id_by_agent_id')
274275
@patch('backend.services.agent_service.search_agent_info_by_agent_id')
@@ -277,7 +278,7 @@ async def test_get_agent_info_impl_success(mock_search_agent_info, mock_search_t
277278
@pytest.mark.asyncio
278279
async def test_get_creating_sub_agent_info_impl_success(mock_get_current_user_info, mock_get_creating_sub_agent,
279280
mock_search_agent_info, mock_get_enable_tools,
280-
mock_query_sub_agents_id):
281+
mock_query_sub_agents_id, mock_get_model_by_model_id):
281282
"""
282283
Test successful retrieval of creating sub-agent information.
283284
@@ -292,11 +293,11 @@ async def test_get_creating_sub_agent_info_impl_success(mock_get_current_user_in
292293
"test_user", "test_tenant", "en")
293294
mock_get_creating_sub_agent.return_value = 456
294295
mock_search_agent_info.return_value = {
295-
"model_id": 456,
296+
"model_id": None,
297+
"model_name": "test_model",
296298
"name": "agent_name",
297299
"display_name": "display name",
298300
"description": "description...",
299-
"model_id": None,
300301
"max_steps": 5,
301302
"business_description": "Sub agent",
302303
"duty_prompt": "Sub duty prompt",
@@ -305,6 +306,9 @@ async def test_get_creating_sub_agent_info_impl_success(mock_get_current_user_in
305306
}
306307
mock_get_enable_tools.return_value = [1, 2]
307308
mock_query_sub_agents_id.return_value = [789]
309+
310+
# Mock get_model_by_model_id - return None for model_id=None
311+
mock_get_model_by_model_id.return_value = None
308312

309313
# Execute
310314
# Ensure the sub agent id remains as initially configured (456)
@@ -318,6 +322,7 @@ async def test_get_creating_sub_agent_info_impl_success(mock_get_current_user_in
318322
"display_name": "display name",
319323
"description": "description...",
320324
"enable_tool_id_list": [1, 2],
325+
"model_name": "test_model",
321326
"model_id": None,
322327
"max_steps": 5,
323328
"business_description": "Sub agent",

0 commit comments

Comments
 (0)