Skip to content

Commit 56b2b54

Browse files
fix testcases
1 parent 3c54f6d commit 56b2b54

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/tests/api/services/test_chat_service.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
# ---- Patch imports before importing the service under test ----
12-
@patch("common.config.config.Config")
12+
@patch("helpers.azure_openai_helper.Config")
1313
@patch("semantic_kernel.agents.AzureAIAgentThread")
1414
@patch("azure.ai.agents.models.TruncationObject")
1515
@patch("semantic_kernel.exceptions.agent_exceptions.AgentException")
@@ -167,8 +167,6 @@ def test_init(self, mock_config_class, mock_request):
167167

168168
service = ChatService(mock_request)
169169

170-
assert service.azure_openai_endpoint == "https://test.openai.azure.com"
171-
assert service.azure_openai_api_version == "2024-02-15-preview"
172170
assert service.azure_openai_deployment_name == "gpt-4o-mini"
173171
assert service.agent == mock_request.app.state.agent
174172
assert ChatService.thread_cache is not None

src/tests/api/services/test_history_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def history_service(mock_config_instance):
2828
# Create patches for other dependencies used by HistoryService
2929
with patch("services.history_service.CosmosConversationClient"):
3030
with patch("services.history_service.AsyncAzureOpenAI"):
31-
with patch("services.history_service.get_bearer_token_provider"):
31+
with patch("helpers.azure_openai_helper.get_bearer_token_provider"):
3232
with patch("services.history_service.complete_chat_request"):
3333
service = HistoryService()
3434
return service
@@ -105,7 +105,7 @@ def test_init_openai_client_no_deployment_name(self, history_service):
105105

106106
def test_init_openai_client_no_api_key(self, history_service):
107107
"""Test OpenAI client initialization with no API key"""
108-
with patch("services.history_service.get_bearer_token_provider", return_value="token_provider"):
108+
with patch("helpers.azure_openai_helper.get_bearer_token_provider", return_value="token_provider"):
109109
with patch("services.history_service.AsyncAzureOpenAI", return_value="openai_client"):
110110
client = history_service.init_openai_client()
111111
assert client == "openai_client"

0 commit comments

Comments
 (0)