-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(issue14) Move agent_manager to respective app/helpers folder
- Loading branch information
Showing
4 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from app.helpers.message_router import MessageRouter | ||
from app.helpers.agent_manager import AgentManager | ||
import os | ||
import sys | ||
import pytest | ||
|
||
sys.path.insert( | ||
0, os.path.abspath(os.path.join( | ||
os.path.dirname(__file__), "..", "..", "..")) | ||
) | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_message_routing(): | ||
# Initialize AgentManager and MessageRouter | ||
agent_manager = AgentManager() | ||
message_router = MessageRouter(agent_manager) | ||
|
||
# Register an agent for testing | ||
await agent_manager.register_agent( | ||
"001", {"name": "Agent Smith", "status": "active"} | ||
) | ||
|
||
# Test message sending | ||
assert ( | ||
await message_router.send_message("001", "Hello, Agent Smith.") | ||
== "Message sent to agent 001." | ||
) | ||
|
||
# Test message fetching | ||
assert await message_router.fetch_messages("001") == ["Hello, Agent Smith."] | ||
|
||
# Test message sending after unregistration | ||
await agent_manager.unregister_agent("001") | ||
assert ( | ||
await message_router.send_message("001", "Hello, Agent Smith.") | ||
== "Agent 001 not found." | ||
) |
2 changes: 1 addition & 1 deletion
2
tests/agents/helpers/agent_manager_test.py → tests/app/helpers/agent_manager_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters