73 lines
2.0 KiB
Python
73 lines
2.0 KiB
Python
"""Tests for BacklogAgent."""
|
|
|
|
import pytest
|
|
from uuid import uuid4
|
|
|
|
from app.agents.backlog_agent import BacklogAgent
|
|
from app.agents.base import AgentResult
|
|
|
|
|
|
@pytest.fixture
|
|
def backlog_agent():
|
|
return BacklogAgent(session=None)
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_backlog_agent_initialization(backlog_agent):
|
|
"""Test BacklogAgent initializes correctly."""
|
|
assert backlog_agent.name == "backlog_agent"
|
|
assert backlog_agent.version == "1.0.0"
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_backlog_agent_health_check(backlog_agent):
|
|
"""Test BacklogAgent health check."""
|
|
result = await backlog_agent.health_check()
|
|
assert result is True
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_backlog_agent_run_without_session(backlog_agent):
|
|
"""Test BacklogAgent run without database session."""
|
|
result = await backlog_agent.run()
|
|
assert result.success is False
|
|
assert "session" in result.message.lower()
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_backlog_agent_suggest_items(backlog_agent):
|
|
"""Test BacklogAgent suggestions."""
|
|
context = {"action": "suggest"}
|
|
result = await backlog_agent.run(context)
|
|
assert result.success
|
|
assert "suggestions" in result.data
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_backlog_agent_list_items(backlog_agent):
|
|
"""Test BacklogAgent list items without session."""
|
|
context = {"action": "list"}
|
|
result = await backlog_agent.run(context)
|
|
assert result.success is False
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_backlog_agent_status(backlog_agent):
|
|
"""Test BacklogAgent status."""
|
|
await backlog_agent.set_running("test")
|
|
assert backlog_agent.status.value == "running"
|
|
|
|
await backlog_agent.set_idle()
|
|
assert backlog_agent.status.value == "idle"
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_backlog_agent_create_without_session(backlog_agent):
|
|
"""Test BacklogAgent create without session."""
|
|
context = {
|
|
"action": "create",
|
|
"title": "Test Task",
|
|
"item_type": "task",
|
|
}
|
|
result = await backlog_agent.run(context)
|
|
assert result.success is False |