|
24 | 24 | from a2a.types import TaskStatusUpdateEvent |
25 | 25 | from a2a.types import TextPart |
26 | 26 | from google.adk.a2a.converters.from_adk_event import convert_event_to_a2a_events |
| 27 | +from google.adk.events import event_actions |
27 | 28 | from google.adk.events.event import Event |
28 | 29 | from google.genai import types as genai_types |
29 | 30 | import pytest |
@@ -106,3 +107,26 @@ def test_convert_event_to_a2a_events_none_artifacts(self): |
106 | 107 | """Test convert_event_to_a2a_events with None agents_artifacts.""" |
107 | 108 | with pytest.raises(ValueError, match="Agents artifacts cannot be None"): |
108 | 109 | convert_event_to_a2a_events(self.mock_event, None) |
| 110 | + |
| 111 | + def test_convert_event_to_a2a_events_with_actions(self): |
| 112 | + """Test conversion of event with actions to TaskStatusUpdateEvent.""" |
| 113 | + self.mock_event.actions = event_actions.EventActions() |
| 114 | + self.mock_event.actions.artifact_delta["image"] = 0 |
| 115 | + |
| 116 | + agents_artifacts = {} |
| 117 | + |
| 118 | + result = convert_event_to_a2a_events( |
| 119 | + self.mock_event, |
| 120 | + agents_artifacts, |
| 121 | + task_id="task-123", |
| 122 | + context_id="context-456", |
| 123 | + ) |
| 124 | + |
| 125 | + assert len(result) == 1 |
| 126 | + assert isinstance(result[0], TaskStatusUpdateEvent) |
| 127 | + assert result[0].task_id == "task-123" |
| 128 | + assert result[0].context_id == "context-456" |
| 129 | + |
| 130 | + metadata = result[0].status.message.metadata |
| 131 | + assert "adk_actions" in metadata |
| 132 | + assert metadata["adk_actions"]["artifactDelta"] == {"image": 0} |
0 commit comments