@@ -44,38 +44,6 @@ def test_get_project_openai_client_success_updated(
4444 api_version = "2025-04-01-preview"
4545 )
4646
47- @patch ("backend.plugins.chat_with_data_plugin.config" )
48- @patch ("backend.plugins.chat_with_data_plugin.AIProjectClient" )
49- @patch ("backend.plugins.chat_with_data_plugin.get_azure_credential" )
50- def test_get_project_openai_client_success (
51- self , mock_default_credential , mock_ai_project_client , mock_config
52- ):
53- """Test successful creation of project OpenAI client."""
54- # Mock config values
55- mock_config .AI_PROJECT_ENDPOINT = "https://test.ai.azure.com"
56- mock_config .AZURE_OPENAI_PREVIEW_API_VERSION = "2025-04-01-preview"
57-
58- mock_credential = MagicMock ()
59- mock_default_credential .return_value = mock_credential
60-
61- mock_project_instance = MagicMock ()
62- mock_openai_client = MagicMock ()
63- mock_project_instance .inference .get_azure_openai_client .return_value = (
64- mock_openai_client
65- )
66- mock_ai_project_client .return_value = mock_project_instance
67-
68- result = self .plugin .get_project_openai_client ()
69-
70- assert result == mock_openai_client
71- mock_default_credential .assert_called_once ()
72- mock_ai_project_client .assert_called_once_with (
73- endpoint = "https://test.ai.azure.com" , credential = mock_credential
74- )
75- mock_project_instance .inference .get_azure_openai_client .assert_called_once_with (
76- api_version = "2025-04-01-preview"
77- )
78-
7947 @pytest .mark .asyncio
8048 @patch ("backend.plugins.chat_with_data_plugin.get_connection" )
8149 @patch ("backend.plugins.chat_with_data_plugin.config" )
0 commit comments