Commit 65cab8d8 by sunqi02 Committed by 胡悦

test: update tests for DB-driven agent config

- test_main.py: use preloaded_agents, new AgentConfig structure
- test_agent_hub.py: replace all 'main'/'meeting' with STEWARD_KEY/MEETING_KEY
- test_read_file_tool.py: use mock config_loader, add preloaded_agents
- PostReplyHook tests: remove account_mapping, add bot_id_mapping to context
- Routing tests: assert response_agent_code == STEWARD_KEY
- Collaboration tests: use dynamic agent keys
1 parent bc718955
...@@ -10,9 +10,7 @@ def _make_test_agents(): ...@@ -10,9 +10,7 @@ def _make_test_agents():
return { return {
"steward_key": AgentConfig( "steward_key": AgentConfig(
name="管家 Agent", code="11", name="管家 Agent", code="11",
prompt="你是智能助手", prompt="你是智能助手", is_steward=True,
description="协调调度各子Agent",
is_steward=True,
), ),
} }
...@@ -20,7 +18,7 @@ def _make_test_agents(): ...@@ -20,7 +18,7 @@ def _make_test_agents():
class TestSkillRegistration: class TestSkillRegistration:
def test_agent_hub_registers_skills_on_init(self): def test_agent_hub_registers_skills_on_init(self):
"""AgentHub.__init__ should register skills to Toolkit via register_agent_skill.""" """AgentHub.__init__ should register skills to Toolkit via register_agent_skill."""
from app.agent_core.agent_hub import AgentHub from app.service.agent_hub import AgentHub
mock_loader = MagicMock() mock_loader = MagicMock()
mock_model_config = MagicMock() mock_model_config = MagicMock()
...@@ -42,7 +40,7 @@ class TestSkillRegistration: ...@@ -42,7 +40,7 @@ class TestSkillRegistration:
def test_agent_hub_skills_loaded_from_toolkit(self): def test_agent_hub_skills_loaded_from_toolkit(self):
"""Skills dict should come from load_skills_from_toolkit, not load_skills.""" """Skills dict should come from load_skills_from_toolkit, not load_skills."""
from app.agent_core.agent_hub import AgentHub from app.service.agent_hub import AgentHub
expected_skills = { expected_skills = {
"buddy-sings": { "buddy-sings": {
......
...@@ -5,8 +5,8 @@ import shutil ...@@ -5,8 +5,8 @@ import shutil
from pathlib import Path from pathlib import Path
from unittest.mock import MagicMock, AsyncMock from unittest.mock import MagicMock, AsyncMock
from app.agent_core.active_session_service import ActiveSessionService from app.service.active_session_service import ActiveSessionService
from app.agent_core.agent_hub import AgentHub from app.service.agent_hub import AgentHub
from agentscope.message._message_block import TextBlock from agentscope.message._message_block import TextBlock
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!