test(spawn_interception_v2): mock send_result not send (Phase 2.18, pre-empts Phase 1.3 regression)

Phase 1.3 migrated run_worker_lifecycle to send_result(). The mock_ai_client
fixture in test_spawn_interception_v2.py mocked src.ai_client.send and
returned a string. The test_run_worker_lifecycle_approved test asserts
on the call_args (user_message + md_content), which still works with
the new mock name.

Changes:
- Replace patch(src.ai_client.send) with patch(src.ai_client.send_result)
- Rename mock_send to mock_send_result
- Wrap mock return_value with Result(data="Task completed")
- Add "from src.result_types import Result" import

All 3 tests in test_spawn_interception_v2.py pass.
This commit is contained in:
ed
2026-06-15 16:24:05 -04:00
parent 7a6ffd8954
commit 16c6705b80
+4 -3
View File
@@ -3,6 +3,7 @@ from unittest.mock import MagicMock, patch
from src import multi_agent_conductor
from src.models import Ticket, WorkerContext
from src import events
from src.result_types import Result
import threading
from typing import Generator
@@ -19,9 +20,9 @@ class MockDialog:
@pytest.fixture
def mock_ai_client() -> Generator[MagicMock, None, None]:
with patch("src.ai_client.send") as mock_send:
mock_send.return_value = "Task completed"
yield mock_send
with patch("src.ai_client.send_result") as mock_send_result:
mock_send_result.return_value = Result(data="Task completed")
yield mock_send_result
def test_confirm_spawn_pushed_to_queue() -> None:
event_queue = events.SyncEventQueue()