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]

test_initialize_router_endpoints

Ishaan Jaffac928ebb1651
diff --git a/tests/router_unit_tests/test_router_endpoints.py b/tests/router_unit_tests/test_router_endpoints.py
index 72256da9b5e..fa8dcb99977 100644
--- a/tests/router_unit_tests/test_router_endpoints.py
+++ b/tests/router_unit_tests/test_router_endpoints.py
@@ -526,3 +526,33 @@ async def test__aadapter_completion():
# Verify async_routing_strategy_pre_call_checks was called
router.async_routing_strategy_pre_call_checks.assert_called_once()
+
+
+def test_initialize_router_endpoints():
+ """
+ Test that initialize_router_endpoints correctly sets up all router endpoints
+ """
+ # Create a router with a basic model
+ router = Router(
+ model_list=[
+ {
+ "model_name": "test-model",
+ "litellm_params": {
+ "model": "anthropic/test-model",
+ "api_key": "fake-api-key",
+ },
+ }
+ ]
+ )
+
+ # Verify all expected endpoints are initialized
+ assert hasattr(router, "amoderation")
+ assert hasattr(router, "aanthropic_messages")
+ assert hasattr(router, "aresponses")
+ assert hasattr(router, "responses")
+
+ # Verify the endpoints are callable
+ assert callable(router.amoderation)
+ assert callable(router.aanthropic_messages)
+ assert callable(router.aresponses)
+ assert callable(router.responses)