diff --git a/lib/crewai/tests/llms/azure/test_azure_credentials.py b/lib/crewai/tests/llms/azure/test_azure_credentials.py index 771210c56..a205397b2 100644 --- a/lib/crewai/tests/llms/azure/test_azure_credentials.py +++ b/lib/crewai/tests/llms/azure/test_azure_credentials.py @@ -12,7 +12,8 @@ from unittest.mock import patch, MagicMock import pytest -ENDPOINT = "https://test.openai.azure.com" +# Use a non-Azure-OpenAI endpoint to avoid _validate_and_fix_endpoint suffixing +ENDPOINT = "https://test-ai.services.example.com" @pytest.fixture @@ -77,7 +78,8 @@ class TestCredentialResolution: ) cred = completion._resolve_credential() assert cred is mock_wi_cred - mock_cls.assert_called_once_with( + # Called at least once with the right args (init may also call it) + mock_cls.assert_any_call( tenant_id="tenant-123", client_id="client-456", token_file_path=str(token_file), @@ -103,7 +105,7 @@ class TestCredentialResolution: completion = AzureCompletion(model="gpt-4") cred = completion._resolve_credential() assert cred is mock_wi_cred - mock_cls.assert_called_once_with( + mock_cls.assert_any_call( tenant_id="env-tenant", client_id="env-client", token_file_path=str(token_file), @@ -128,7 +130,7 @@ class TestCredentialResolution: ) cred = completion._resolve_credential() assert cred is mock_cs_cred - mock_cls.assert_called_once_with( + mock_cls.assert_any_call( tenant_id="tenant-123", client_id="client-456", client_secret="sp-secret",