From 26e1b652989632efd9d01a2d3d6b50aa169aaee7 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 15 Jun 2026 20:27:07 -0400 Subject: [PATCH] test(rag_integration): wrap _send_gemini mock return in Result(data=...) The test_rag_integration test mocks the internal _send_gemini function to return a raw string. The production code in app_controller._handle_request_event now does 'if result.ok:' which fails on raw strings. Change: mock_provider.return_value = 'Mock AI Response' -> mock_provider.return_value = Result(data='Mock AI Response') Plus add the Result import. 1 test passes (was 1 pre-existing failure). --- tests/test_rag_integration.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_rag_integration.py b/tests/test_rag_integration.py index b552f70c..2c200c10 100644 --- a/tests/test_rag_integration.py +++ b/tests/test_rag_integration.py @@ -8,6 +8,7 @@ from src.app_controller import AppController from src import ai_client from src import events from src import models +from src.result_types import Result @pytest.fixture def mock_project(): @@ -74,7 +75,7 @@ def test_rag_integration(mock_project): # _send_gemini which is what actually "sends to the provider". with patch('src.ai_client.send_result', wraps=ai_client.send_result) as mock_send: with patch('src.ai_client._send_gemini') as mock_provider: - mock_provider.return_value = "Mock AI Response" + mock_provider.return_value = Result(data="Mock AI Response") # Create a UserRequestEvent as if the user clicked "Gen + Send" event = events.UserRequestEvent(