Initial commit: VoIdeaAI - voice-first AI idea assistant
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
"""Tests for AgentRegistry."""
|
||||
|
||||
import pytest
|
||||
|
||||
from app.agents.registry import AgentRegistry, get_agent, get_all_agents
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def registry():
|
||||
return AgentRegistry()
|
||||
|
||||
|
||||
def test_registry_initialization(registry):
|
||||
"""Test registry initializes with all agents."""
|
||||
agents = registry.list_agents()
|
||||
assert len(agents) >= 5
|
||||
agent_names = [a["name"] for a in agents]
|
||||
assert "doc_agent" in agent_names
|
||||
assert "backlog_agent" in agent_names
|
||||
assert "spec_agent" in agent_names
|
||||
assert "audit_agent" in agent_names
|
||||
assert "observer_agent" in agent_names
|
||||
assert "evolution_agent" in agent_names
|
||||
|
||||
|
||||
def test_get_agent(registry):
|
||||
"""Test getting specific agent."""
|
||||
agent = registry.get("doc_agent")
|
||||
assert agent is not None
|
||||
assert agent.name == "doc_agent"
|
||||
|
||||
|
||||
def test_get_nonexistent_agent(registry):
|
||||
"""Test getting non-existent agent."""
|
||||
agent = registry.get("nonexistent_agent")
|
||||
assert agent is None
|
||||
|
||||
|
||||
def test_list_agents(registry):
|
||||
"""Test listing all agents."""
|
||||
agents = registry.list_agents()
|
||||
assert isinstance(agents, list)
|
||||
assert all("name" in a for a in agents)
|
||||
assert all("status" in a for a in agents)
|
||||
|
||||
|
||||
def test_get_all_agents_function():
|
||||
"""Test get_all_agents function."""
|
||||
agents = get_all_agents()
|
||||
assert isinstance(agents, list)
|
||||
assert len(agents) > 0
|
||||
|
||||
|
||||
def test_get_agent_function():
|
||||
"""Test get_agent function."""
|
||||
agent = get_agent("spec_agent")
|
||||
assert agent is not None
|
||||
assert agent.name == "spec_agent"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_run_nonexistent_agent(registry):
|
||||
"""Test running non-existent agent."""
|
||||
result = await registry.run_agent("nonexistent")
|
||||
assert result.success is False
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_health_check_all(registry):
|
||||
"""Test health check for all agents."""
|
||||
results = await registry.health_check_all()
|
||||
assert isinstance(results, dict)
|
||||
assert all(isinstance(v, bool) for v in results.values())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_metrics_all(registry):
|
||||
"""Test getting metrics for all agents."""
|
||||
metrics = registry.get_metrics_all()
|
||||
assert isinstance(metrics, dict)
|
||||
assert all("status" in m for m in metrics.values())
|
||||
Reference in New Issue
Block a user