Buckets:

download
raw
2.36 kB
"""Agent Method Tests.
Target: +8% Coverage durch Agent-Methoden-Tests.
"""
from unittest.mock import AsyncMock, Mock, patch
import pytest
from agents.agent_base import AgentMessage, AgentRole, AgentState
from agents.agent_orchestrator import AgentOrchestrator
class TestAgentMessage:
"""Tests for AgentMessage."""
def test_message_creation(self):
"""Test creating an agent message."""
msg = AgentMessage(
sender="agent1",
recipient="agent2",
content="Test message",
)
assert msg.sender == "agent1"
assert msg.recipient == "agent2"
assert msg.content == "Test message"
def test_message_string_content(self):
"""Test message with string content."""
msg = AgentMessage(sender="agent1", recipient="agent2")
assert isinstance(msg.content, str)
class TestAgentOrchestrator:
"""Tests for AgentOrchestrator."""
@pytest.fixture
def orchestrator(self):
"""Create a test orchestrator."""
return AgentOrchestrator()
def test_orchestrator_init(self, orchestrator):
"""Test orchestrator initialization."""
assert orchestrator is not None
def test_register_agent(self, orchestrator):
"""Test registering an agent."""
mock_agent = Mock()
mock_agent.name = "test_agent"
orchestrator.register(mock_agent)
# Check if agent was registered
def test_orchestrator_str(self, orchestrator):
"""Test orchestrator string representation."""
str_repr = str(orchestrator)
assert isinstance(str_repr, str)
class TestAgentRoleAndState:
"""Tests for AgentRole and AgentState enums."""
def test_agent_role_values(self):
"""Test AgentRole enum values."""
assert AgentRole.RESEARCHER.value == "researcher"
assert AgentRole.ANALYST.value == "analyst"
def test_agent_role_exploit(self):
"""Test AgentRole exploit value."""
assert AgentRole.EXPLOIT.value == "exploit"
def test_agent_state_values(self):
"""Test AgentState enum values."""
assert AgentState.IDLE.value == "idle"
assert AgentState.BUSY.value == "busy"
def test_agent_state_stopped(self):
"""Test AgentState stopped value."""
assert AgentState.STOPPED.value == "stopped"

Xet Storage Details

Size:
2.36 kB
·
Xet hash:
c22d6d2d4e90d3ba2b6e27cfc8317fdcceecc3c5d8cb209141fded91374451d8

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.