|
3 | 3 | from a2a import types |
4 | 4 | from a2a.grpc import a2a_pb2 |
5 | 5 | from a2a.utils import proto_utils |
6 | | -from a2a.utils.errors import ServerError |
7 | 6 |
|
8 | 7 |
|
9 | 8 | # --- Test Data --- |
@@ -119,17 +118,6 @@ def test_roundtrip_message(self, sample_message: types.Message): |
119 | 118 | roundtrip_msg = proto_utils.FromProto.message(proto_msg) |
120 | 119 | assert roundtrip_msg == sample_message |
121 | 120 |
|
122 | | - def test_roundtrip_agent_card(self, sample_agent_card: types.AgentCard): |
123 | | - """Test conversion of AgentCard to proto and back.""" |
124 | | - proto_card = proto_utils.ToProto.agent_card(sample_agent_card) |
125 | | - assert isinstance(proto_card, a2a_pb2.AgentCard) |
126 | | - |
127 | | - roundtrip_card = proto_utils.FromProto.agent_card(proto_card) |
128 | | - # Pydantic models with nested dicts/lists might not be equal after roundtrip, so check fields |
129 | | - assert roundtrip_card.name == sample_agent_card.name |
130 | | - assert roundtrip_card.provider == sample_agent_card.provider |
131 | | - assert roundtrip_card.skills == sample_agent_card.skills |
132 | | - |
133 | 121 | def test_enum_conversions(self): |
134 | 122 | """Test conversions for all enum types.""" |
135 | 123 | assert ( |
@@ -162,42 +150,6 @@ def test_enum_conversions(self): |
162 | 150 | == a2a_pb2.TaskState.TASK_STATE_UNSPECIFIED |
163 | 151 | ) |
164 | 152 |
|
165 | | - def test_task_id_params_parsing(self): |
166 | | - """Test parsing of task and push notification config names.""" |
167 | | - cancel_req = a2a_pb2.CancelTaskRequest(name='tasks/task-123') |
168 | | - params = proto_utils.FromProto.task_id_params(cancel_req) |
169 | | - assert params.id == 'task-123' |
170 | | - |
171 | | - push_req = a2a_pb2.GetTaskPushNotificationRequest( |
172 | | - name='tasks/task-456/pushNotifications/config-789' |
173 | | - ) |
174 | | - params_push = proto_utils.FromProto.task_id_params(push_req) |
175 | | - assert params_push.id == 'task-456' |
176 | | - |
177 | | - with pytest.raises(ServerError): |
178 | | - proto_utils.FromProto.task_id_params( |
179 | | - a2a_pb2.CancelTaskRequest(name='invalid/name') |
180 | | - ) |
181 | | - |
182 | | - with pytest.raises(ServerError): |
183 | | - proto_utils.FromProto.task_id_params( |
184 | | - a2a_pb2.GetTaskPushNotificationRequest(name='invalid/name') |
185 | | - ) |
186 | | - |
187 | | - def test_task_query_params_parsing(self): |
188 | | - """Test parsing of GetTaskRequest.""" |
189 | | - get_req = a2a_pb2.GetTaskRequest( |
190 | | - name='tasks/task-abc', history_length=10 |
191 | | - ) |
192 | | - params = proto_utils.FromProto.task_query_params(get_req) |
193 | | - assert params.id == 'task-abc' |
194 | | - assert params.historyLength == 10 |
195 | | - |
196 | | - with pytest.raises(ServerError): |
197 | | - proto_utils.FromProto.task_query_params( |
198 | | - a2a_pb2.GetTaskRequest(name='invalid/name') |
199 | | - ) |
200 | | - |
201 | 153 | def test_oauth_flows_conversion(self): |
202 | 154 | """Test conversion of different OAuth2 flows.""" |
203 | 155 | # Test password flow |
|
0 commit comments