litellm/tests/test_litellm_rust/support/served.py
Nate Armstrong 87d91d78b7
refactor(router): route the router family through RoutingContext and close the outside surface (#49118)
Strategies, pre-call checks, cooldown and fallback helpers, and the auto, complexity and quality
sub-routers now take a RoutingContext instead of the Router, and read the router only through
registry(), settings(), health() and the context's forwarding methods. Router-free helpers move
from router_utils to litellm_core_utils, outside callers of router state switch to entry points,
and the surface allowlist shrinks to the endpoint methods plus the entry points
2026-10-30 19:18:54 -07:00

16 lines
760 B
Python

from typing import Final
from litellm.litellm_core_utils.add_retry_fallback_headers import get_hidden_params_dict
from tests.test_litellm_rust.support.recording_server import RecordingServer
def assert_served_natively(server: RecordingServer, *responses: object, count: int = 1) -> None:
assert len(server.requests) == (len(responses) or count)
if not responses:
assert not any(
request.headers.get("user-agent", "").startswith("python-httpx") for request in server.requests
)
for response in responses:
additional_headers: Final = get_hidden_params_dict(response).get("additional_headers")
assert isinstance(additional_headers, dict)
assert additional_headers.get("x-litellm-rust") == "true"