Skip to content

Commit 7594126

Browse files
committed
Update test_app_config.py
1 parent 9f7caf7 commit 7594126

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/tests/backend/common/config/test_app_config.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,21 +110,22 @@ def test_initialization_with_all_env_vars(self):
110110
@patch.dict(os.environ, {}, clear=True)
111111
def test_missing_required_variable_raises_error(self):
112112
"""Test that missing required environment variables raise ValueError."""
113-
# Missing APPLICATIONINSIGHTS_CONNECTION_STRING
113+
# Missing AZURE_OPENAI_ENDPOINT (a required variable with no default).
114+
# NOTE: APPLICATIONINSIGHTS_CONNECTION_STRING is optional, so its absence
115+
# does not raise; AZURE_OPENAI_ENDPOINT is the first required no-default var.
114116
incomplete_env = {
115117
"APP_ENV": "test",
116118
"AZURE_OPENAI_DEPLOYMENT_NAME": "test-gpt-4o",
117119
"AZURE_OPENAI_RAI_DEPLOYMENT_NAME": "test-gpt-4.1",
118120
"AZURE_OPENAI_API_VERSION": "2024-11-20",
119-
"AZURE_OPENAI_ENDPOINT": "https://test.openai.azure.com",
120121
"AZURE_AI_SUBSCRIPTION_ID": "test-subscription-id",
121122
"AZURE_AI_RESOURCE_GROUP": "test-resource-group",
122123
"AZURE_AI_PROJECT_NAME": "test-project",
123124
"AZURE_AI_AGENT_ENDPOINT": "https://test.ai.azure.com"
124125
}
125126

126127
with patch.dict(os.environ, incomplete_env):
127-
with pytest.raises(ValueError, match="Environment variable APPLICATIONINSIGHTS_CONNECTION_STRING not found"):
128+
with pytest.raises(ValueError, match="Environment variable AZURE_OPENAI_ENDPOINT not found"):
128129
AppConfig()
129130

130131
def test_logger_initialization(self):

0 commit comments

Comments
 (0)