Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

unit test oai pass through

Ishaan Jaff7f5460465c5d
diff --git a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_openai_passthrough_logging_handler.py b/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_openai_passthrough_logging_handler.py
index 6f808c9759c..789b16f9515 100644
--- a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_openai_passthrough_logging_handler.py
+++ b/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_openai_passthrough_logging_handler.py
@@ -3,10 +3,10 @@ import os
import sys
from datetime import datetime
from typing import Any, Dict, List
-from unittest.mock import MagicMock, patch, AsyncMock
+from unittest.mock import AsyncMock, MagicMock, patch
-import pytest
import httpx
+import pytest
sys.path.insert(
0, os.path.abspath("../../..")
@@ -88,7 +88,8 @@ class TestOpenAIPassthroughLoggingHandler:
def test_get_provider_config(self):
"""Test that the handler returns an OpenAI config"""
- config = OpenAIPassthroughLoggingHandler.get_provider_config(model="gpt-4o")
+ handler = OpenAIPassthroughLoggingHandler()
+ config = handler.get_provider_config(model="gpt-4o")
assert config is not None
# Verify it's an OpenAI config by checking if it has the expected methods
assert hasattr(config, 'transform_response')
@@ -364,7 +365,9 @@ class TestOpenAIPassthroughLoggingHandler:
"""Test that static methods work correctly"""
# Test static method calls
assert OpenAIPassthroughLoggingHandler.is_openai_chat_completions_route("https://api.openai.com/v1/chat/completions") == True
- assert OpenAIPassthroughLoggingHandler.get_provider_config("gpt-4o") is not None
+ # Test instance method
+ handler = OpenAIPassthroughLoggingHandler()
+ assert handler.get_provider_config("gpt-4o") is not None
class TestOpenAIPassthroughIntegration: