Files
crewAI/tests/a2a/test_server_config.py
Devin AI 4b9426fbcc fix: Resolve lint and type-checking issues in A2A integration
- Remove unused imports (uuid, List, Part, TextPart)
- Fix type-checking errors for task_id and context_id validation
- Remove invalid AgentCard parameter (supported_content_types)
- Update test expectations for JSON output conversion
- Fix TaskInfo structure usage in cancel test
- Update server function call signatures in tests

All A2A tests now pass (34 passed, 2 skipped)

Co-Authored-By: João <joao@crewai.com>
2025-06-06 23:50:21 +00:00

54 lines
1.7 KiB
Python

"""Tests for ServerConfig dataclass."""
import pytest
try:
from crewai.a2a.server import ServerConfig
A2A_AVAILABLE = True
except ImportError:
A2A_AVAILABLE = False
@pytest.mark.skipif(not A2A_AVAILABLE, reason="A2A integration not available")
class TestServerConfig:
"""Test ServerConfig dataclass functionality."""
def test_server_config_defaults(self):
"""Test ServerConfig with default values."""
config = ServerConfig()
assert config.host == "localhost"
assert config.port == 10001
assert config.transport == "starlette"
assert config.agent_name is None
assert config.agent_description is None
def test_server_config_custom_values(self):
"""Test ServerConfig with custom values."""
config = ServerConfig(
host="0.0.0.0",
port=8080,
transport="custom",
agent_name="Test Agent",
agent_description="A test agent"
)
assert config.host == "0.0.0.0"
assert config.port == 8080
assert config.transport == "custom"
assert config.agent_name == "Test Agent"
assert config.agent_description == "A test agent"
def test_server_config_partial_override(self):
"""Test ServerConfig with partial value override."""
config = ServerConfig(
port=9000,
agent_name="Custom Agent"
)
assert config.host == "localhost" # default
assert config.port == 9000 # custom
assert config.transport == "starlette" # default
assert config.agent_name == "Custom Agent" # custom
assert config.agent_description is None # default