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]

TestCallbackManagementEndpoints

Ishaan Jaffe75f4c85616a
diff --git a/tests/test_litellm/proxy/management_endpoints/test_callback_management_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_callback_management_endpoints.py
index 5990af595df..140dc644973 100644
--- a/tests/test_litellm/proxy/management_endpoints/test_callback_management_endpoints.py
+++ b/tests/test_litellm/proxy/management_endpoints/test_callback_management_endpoints.py
@@ -13,11 +13,31 @@ sys.path.insert(
from typing import cast
+from fastapi import FastAPI
+
import litellm
from litellm.integrations.datadog.datadog import DataDogLogger
from litellm.integrations.langfuse.langfuse import LangFuseLogger
from litellm.proxy.management_endpoints.callback_management_endpoints import router
-from litellm.proxy.proxy_server import app
+from litellm.proxy.proxy_server import (
+ _description,
+ _get_docs_url,
+ _get_redoc_url,
+ _title,
+ proxy_startup_event,
+ server_root_path,
+ version,
+)
+
+app = FastAPI(
+ docs_url=_get_docs_url(),
+ redoc_url=_get_redoc_url(),
+ title=_title,
+ description=_description,
+ version=version,
+ root_path=server_root_path, # check if user passed root path, FastAPI defaults this value to ""
+ lifespan=proxy_startup_event,
+)
@pytest.fixture(autouse=True, scope="session")
@@ -46,7 +66,7 @@ class TestCallbackManagementEndpoints:
litellm._async_failure_callback = []
litellm.callbacks = []
- def test_list_callbacks_no_active_callbacks(self):
+ def test_alist_callbacks_no_active_callbacks(self):
"""Test /callbacks/list endpoint with no active callbacks"""
# Setup test client
client = TestClient(app)
@@ -75,7 +95,7 @@ class TestCallbackManagementEndpoints:
"LANGFUSE_SECRET_KEY": "test_secret_key",
"LANGFUSE_HOST": "https://test.langfuse.com"
})
- def test_list_callbacks_with_langfuse_logger(self):
+ def test_alist_callbacks_with_langfuse_logger(self):
"""Test /callbacks/list endpoint with real Langfuse logger initialized"""
# Setup test client
client = TestClient(app)
@@ -112,7 +132,7 @@ class TestCallbackManagementEndpoints:
assert isinstance(response_data["failure"], list)
assert isinstance(response_data["success_and_failure"], list)
- def test_list_callbacks_with_datadog_logger(self):
+ def test_alist_callbacks_with_datadog_logger(self):
"""Test /callbacks/list endpoint with DataDog logger configuration"""
# Setup test client
client = TestClient(app)
@@ -148,7 +168,7 @@ class TestCallbackManagementEndpoints:
assert isinstance(response_data["failure"], list)
assert isinstance(response_data["success_and_failure"], list)
- def test_list_callbacks_mixed_callback_types(self):
+ def test_alist_callbacks_mixed_callback_types(self):
"""Test /callbacks/list endpoint with mixed callback types (string and logger instances)"""
# Setup test client
client = TestClient(app)
@@ -192,7 +212,7 @@ class TestCallbackManagementEndpoints:
assert len(set(all_callbacks)) == len(all_callbacks)
- def test_list_callbacks_empty_response_structure(self):
+ def test_alist_callbacks_empty_response_structure(self):
"""Test that response always has correct structure even with no callbacks"""
# Setup test client
client = TestClient(app)