Fix Azure OpenAI test (#2217)

This commit is contained in:
Dev Khant
2025-02-17 19:21:12 +05:30
committed by GitHub
parent 095189d39a
commit f16a580ef6

View File

@@ -97,8 +97,8 @@ def test_generate_response_with_tools(mock_openai_client):
[None, {"Firstkey": "FirstVal", "SecondKey": "SecondVal"}], [None, {"Firstkey": "FirstVal", "SecondKey": "SecondVal"}],
) )
def test_generate_with_http_proxies(default_headers): def test_generate_with_http_proxies(default_headers):
mock_http_client = Mock(spec=httpx.Client) mock_http_client = Mock()
mock_http_client_instance = Mock(spec=httpx.Client) mock_http_client_instance = Mock()
mock_http_client.return_value = mock_http_client_instance mock_http_client.return_value = mock_http_client_instance
azure_kwargs = {"api_key": "test"} azure_kwargs = {"api_key": "test"}
if default_headers: if default_headers:
@@ -106,7 +106,7 @@ def test_generate_with_http_proxies(default_headers):
with ( with (
patch("mem0.llms.azure_openai.AzureOpenAI") as mock_azure_openai, patch("mem0.llms.azure_openai.AzureOpenAI") as mock_azure_openai,
patch("httpx.Client", new=mock_http_client) as mock_http_client, patch("httpx.Client", new=mock_http_client),
): ):
config = BaseLlmConfig( config = BaseLlmConfig(
model=MODEL, model=MODEL,