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).
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user