@@ -131,10 +131,7 @@ def test_ask_question(genie, mock_workspace_client):
131131 ]
132132 )
133133
134- mock_mcp_client = MagicMock ()
135- mock_mcp_client .call_tool .return_value = mock_mcp_result
136-
137- with patch .object (genie , "_get_mcp_client" , return_value = mock_mcp_client ):
134+ with patch .object (genie ._mcp_client , "call_tool" , return_value = mock_mcp_result ):
138135 genie_result = genie .ask_question ("What is the meaning of life?" )
139136 assert genie_result .result == "Answer"
140137 assert genie_result .conversation_id == "123"
@@ -150,10 +147,7 @@ def test_ask_question_continued_conversation(genie, mock_workspace_client):
150147 ]
151148 )
152149
153- mock_mcp_client = MagicMock ()
154- mock_mcp_client .call_tool .return_value = mock_mcp_result
155-
156- with patch .object (genie , "_get_mcp_client" , return_value = mock_mcp_client ):
150+ with patch .object (genie ._mcp_client , "call_tool" , return_value = mock_mcp_result ):
157151 genie_result = genie .ask_question ("What is the meaning of life?" , "123" )
158152 assert genie_result .result == "42"
159153 assert genie_result .conversation_id == "123"
@@ -169,14 +163,11 @@ def test_ask_question_calls_mcp_without_conversation_id(genie, mock_workspace_cl
169163 ]
170164 )
171165
172- mock_mcp_client = MagicMock ()
173- mock_mcp_client .call_tool .return_value = mock_mcp_result
174-
175- with patch .object (genie , "_get_mcp_client" , return_value = mock_mcp_client ):
166+ with patch .object (genie ._mcp_client , "call_tool" , return_value = mock_mcp_result ) as mock_call :
176167 genie .ask_question ("What is the meaning of life?" )
177168
178169 # Verify MCP client was called with correct args (no conversation_id)
179- mock_mcp_client . call_tool .assert_called_once_with (
170+ mock_call .assert_called_once_with (
180171 "query_space_test_space_id" , {"query" : "What is the meaning of life?" }
181172 )
182173
@@ -192,14 +183,11 @@ def test_ask_question_calls_mcp_with_conversation_id(genie, mock_workspace_clien
192183 ]
193184 )
194185
195- mock_mcp_client = MagicMock ()
196- mock_mcp_client .call_tool .return_value = mock_mcp_result
197-
198- with patch .object (genie , "_get_mcp_client" , return_value = mock_mcp_client ):
186+ with patch .object (genie ._mcp_client , "call_tool" , return_value = mock_mcp_result ) as mock_call :
199187 genie .ask_question ("What is the meaning of life?" , "123" )
200188
201189 # Verify MCP client was called with conversation_id included
202- mock_mcp_client . call_tool .assert_called_once_with (
190+ mock_call .assert_called_once_with (
203191 "query_space_test_space_id" ,
204192 {"query" : "What is the meaning of life?" , "conversation_id" : "123" },
205193 )
0 commit comments