mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-03 04:22:22 +00:00
fix the test issue from the pr review
This commit is contained in:
@@ -1091,7 +1091,7 @@ async def test_google_generate_content_with_openai():
|
||||
)
|
||||
|
||||
# Use AsyncMock for proper async function mocking
|
||||
with unittest.mock.patch("litellm.completion", new_callable=unittest.mock.MagicMock) as mock_completion:
|
||||
with unittest.mock.patch("litellm.acompletion", new_callable=unittest.mock.AsyncMock) as mock_completion:
|
||||
# Set the return value directly on the MagicMock
|
||||
mock_completion.return_value = mock_response
|
||||
|
||||
@@ -1100,7 +1100,7 @@ async def test_google_generate_content_with_openai():
|
||||
contents=[
|
||||
{"role": "user", "parts": [{"text": "Hello, world!"}]}
|
||||
],
|
||||
systemInstruction="You are a helpful assistant.",
|
||||
systemInstruction={"parts": [{"text": "You are a helpful assistant."}]},
|
||||
safetySettings=[
|
||||
{
|
||||
"category": "HARM_CATEGORY_HATE_SPEECH",
|
||||
@@ -1199,4 +1199,4 @@ async def test_agenerate_content_x_goog_api_key_header():
|
||||
assert headers.get("Content-Type") == "application/json", f"Expected Content-Type application/json, got {headers.get('Content-Type')}"
|
||||
|
||||
print(f"✓ Test passed: x-goog-api-key header correctly set to {api_key_value}")
|
||||
print(f"✓ All headers: {list(headers.keys())}")
|
||||
print(f"✓ All headers: {list(headers.keys())}")
|
||||
|
||||
Reference in New Issue
Block a user