|
1 | 1 | import pytest |
2 | 2 | from agenticlayer.a2a_starlette import agent_to_a2a_starlette |
3 | 3 | from google.adk.agents.base_agent import BaseAgent |
| 4 | +from starlette.applications import Starlette |
4 | 5 | from starlette.testclient import TestClient |
5 | 6 |
|
6 | 7 |
|
7 | | -class SimpleTestAgent(BaseAgent): |
8 | | - """A simple test agent implementation.""" |
9 | | - |
10 | | - def __init__(self): |
11 | | - # BaseAgent is a Pydantic model that requires a name field |
12 | | - super().__init__(name="test_agent") |
13 | | - |
14 | | - def process_request(self, request): |
15 | | - """Mock implementation of request processing.""" |
16 | | - return {"response": "test response"} |
17 | | - |
18 | | - |
19 | 8 | class TestA2AStarlette: |
20 | 9 | """Test suite for the a2a_starlette module.""" |
21 | 10 |
|
22 | 11 | @pytest.fixture |
23 | | - def test_agent(self): |
| 12 | + def test_agent(self) -> BaseAgent: |
24 | 13 | """Create a test agent for testing.""" |
25 | | - return SimpleTestAgent() |
| 14 | + return BaseAgent(name="test_agent") |
26 | 15 |
|
27 | 16 | @pytest.fixture |
28 | | - def starlette_app(self, test_agent): |
| 17 | + def starlette_app(self, test_agent: BaseAgent) -> Starlette: |
29 | 18 | """Create a Starlette app with the test agent.""" |
30 | 19 | return agent_to_a2a_starlette(test_agent) |
31 | 20 |
|
32 | 21 | @pytest.fixture |
33 | | - def client(self, starlette_app): |
| 22 | + def client(self, starlette_app: Starlette) -> TestClient: |
34 | 23 | """Create a test client.""" |
35 | 24 | return TestClient(starlette_app) |
36 | 25 |
|
37 | | - def test_health_endpoint(self, client): |
| 26 | + def test_health_endpoint(self, client: TestClient) -> None: |
38 | 27 | """Test that the health check endpoint works.""" |
39 | 28 | response = client.get("/health") |
40 | 29 | assert response.status_code == 200 |
41 | 30 | data = response.json() |
42 | 31 | assert data["status"] == "healthy" |
43 | 32 |
|
44 | | - def test_agent_card_endpoint(self, starlette_app, client): |
| 33 | + def test_agent_card_endpoint(self, starlette_app: Starlette, client: TestClient) -> None: |
45 | 34 | """Test that the agent card is available at /.well-known/agent-card.json""" |
46 | 35 |
|
47 | 36 | # Try the standard agent card endpoint |
|
0 commit comments