mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-22 06:18:14 +00:00
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>
This commit is contained in:
53
tests/a2a/test_server_config.py
Normal file
53
tests/a2a/test_server_config.py
Normal file
@@ -0,0 +1,53 @@
|
||||
"""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
|
||||
Reference in New Issue
Block a user