@@ -180,14 +180,12 @@ async def test_get_sql_response_openai_error(self, mock_get_sql_agent, mock_conf
180180 assert "OpenAI API error" in result
181181
182182 @pytest .mark .asyncio
183- @patch ("backend.plugins.chat_with_data_plugin.hasattr" , return_value = False )
184183 @patch ("backend.agents.agent_factory.AgentFactory.get_search_agent" )
185- @patch ("backend.plugins.chat_with_data_plugin.config" )
186184 async def test_get_answers_from_calltranscripts_success (
187- self , mock_config , mock_get_search_agent , mock_hasattr
185+ self , mock_get_search_agent
188186 ):
189187 """Test successful retrieval of answers from call transcripts using AI Search Agent."""
190- # Setup mocks for agent factory (fallback case when current_app.search_agent is None)
188+ # Setup mocks for agent factory
191189 mock_agent = MagicMock ()
192190 mock_agent .id = "test-agent-id"
193191
@@ -197,10 +195,6 @@ async def test_get_answers_from_calltranscripts_success(
197195 "client" : mock_project_client ,
198196 }
199197
200- # Mock config values
201- mock_config .AZURE_SEARCH_INDEX = "test-index"
202- mock_config .AZURE_SEARCH_CONNECTION_NAME = "test-connection"
203-
204198 # Mock project index creation
205199 mock_index = MagicMock ()
206200 mock_index .name = "project-index-test"
@@ -235,7 +229,7 @@ async def test_get_answers_from_calltranscripts_success(
235229 assert "Based on call transcripts" in result
236230 assert "investment options" in result
237231
238- # Verify agent factory was called (fallback case)
232+ # Verify agent factory was called
239233 mock_get_search_agent .assert_called_once ()
240234
241235 # Verify project index was created/updated
@@ -255,11 +249,9 @@ async def test_get_answers_from_calltranscripts_success(
255249 mock_project_client .agents .runs .create_and_process .assert_called_once ()
256250
257251 @pytest .mark .asyncio
258- @patch ("backend.plugins.chat_with_data_plugin.hasattr" , return_value = False )
259252 @patch ("backend.agents.agent_factory.AgentFactory.get_search_agent" )
260- @patch ("backend.plugins.chat_with_data_plugin.config" )
261253 async def test_get_answers_from_calltranscripts_no_results (
262- self , mock_config , mock_get_search_agent , mock_hasattr
254+ self , mock_get_search_agent
263255 ):
264256 """Test call transcripts search with no results."""
265257 # Setup mocks for agent factory
@@ -272,10 +264,6 @@ async def test_get_answers_from_calltranscripts_no_results(
272264 "client" : mock_project_client ,
273265 }
274266
275- # Mock config values
276- mock_config .AZURE_SEARCH_INDEX = "test-index"
277- mock_config .AZURE_SEARCH_CONNECTION_NAME = "test-connection"
278-
279267 # Mock project index creation
280268 mock_index = MagicMock ()
281269 mock_index .name = "project-index-test"
@@ -307,11 +295,9 @@ async def test_get_answers_from_calltranscripts_no_results(
307295 assert "No data found for that client." in result
308296
309297 @pytest .mark .asyncio
310- @patch ("backend.plugins.chat_with_data_plugin.hasattr" , return_value = False )
311298 @patch ("backend.agents.agent_factory.AgentFactory.get_search_agent" )
312- @patch ("backend.plugins.chat_with_data_plugin.config" )
313299 async def test_get_answers_from_calltranscripts_openai_error (
314- self , mock_config , mock_get_search_agent , mock_hasattr
300+ self , mock_get_search_agent
315301 ):
316302 """Test call transcripts with AI Search processing error."""
317303 # Setup mocks for agent factory
@@ -324,10 +310,6 @@ async def test_get_answers_from_calltranscripts_openai_error(
324310 "client" : mock_project_client ,
325311 }
326312
327- # Mock config values
328- mock_config .AZURE_SEARCH_INDEX = "test-index"
329- mock_config .AZURE_SEARCH_CONNECTION_NAME = "test-connection"
330-
331313 # Mock project index creation
332314 mock_index = MagicMock ()
333315 mock_index .name = "project-index-test"
@@ -354,11 +336,9 @@ async def test_get_answers_from_calltranscripts_openai_error(
354336 assert "Error retrieving data from call transcripts" in result
355337
356338 @pytest .mark .asyncio
357- @patch ("backend.plugins.chat_with_data_plugin.hasattr" , return_value = False )
358339 @patch ("backend.agents.agent_factory.AgentFactory.get_search_agent" )
359- @patch ("backend.plugins.chat_with_data_plugin.config" )
360340 async def test_get_answers_from_calltranscripts_failed_run (
361- self , mock_config , mock_get_search_agent , mock_hasattr
341+ self , mock_get_search_agent
362342 ):
363343 """Test call transcripts with failed AI Search run."""
364344 # Setup mocks for agent factory
@@ -371,10 +351,6 @@ async def test_get_answers_from_calltranscripts_failed_run(
371351 "client" : mock_project_client ,
372352 }
373353
374- # Mock config values
375- mock_config .AZURE_SEARCH_INDEX = "test-index"
376- mock_config .AZURE_SEARCH_CONNECTION_NAME = "test-connection"
377-
378354 # Mock project index creation
379355 mock_index = MagicMock ()
380356 mock_index .name = "project-index-test"
@@ -402,11 +378,9 @@ async def test_get_answers_from_calltranscripts_failed_run(
402378 assert "Error retrieving data from call transcripts" in result
403379
404380 @pytest .mark .asyncio
405- @patch ("backend.plugins.chat_with_data_plugin.hasattr" , return_value = False )
406381 @patch ("backend.agents.agent_factory.AgentFactory.get_search_agent" )
407- @patch ("backend.plugins.chat_with_data_plugin.config" )
408382 async def test_get_answers_from_calltranscripts_empty_response (
409- self , mock_config , mock_get_search_agent , mock_hasattr
383+ self , mock_get_search_agent
410384 ):
411385 """Test call transcripts with empty response text."""
412386 # Setup mocks for agent factory
@@ -419,10 +393,6 @@ async def test_get_answers_from_calltranscripts_empty_response(
419393 "client" : mock_project_client ,
420394 }
421395
422- # Mock config values
423- mock_config .AZURE_SEARCH_INDEX = "test-index"
424- mock_config .AZURE_SEARCH_CONNECTION_NAME = "test-connection"
425-
426396 # Mock project index creation
427397 mock_index = MagicMock ()
428398 mock_index .name = "project-index-test"
0 commit comments