mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-14 09:03:16 +00:00
test(security): resolve budget request route identifiers from their own fixtures (#51659)
Co-authored-by: mateo <277851410+mateo-berri@users.noreply.github.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
a166574ba4
commit
45b726fdab
1 changed files with 7 additions and 1 deletions
|
|
@ -134,6 +134,9 @@ PARAMETER_ALIASES: Final = MappingProxyType(
|
|||
{
|
||||
"/models/{model_id}": {"model_id": "model"},
|
||||
"/v1/models/{model_id}": {"model_id": "model"},
|
||||
"/management/v1/customer_budget_increase_requests/{request_id}": {
|
||||
"request_id": "budget_increase_request_id"
|
||||
},
|
||||
}
|
||||
)
|
||||
NOT_FOUND_EXPECTED: Final = MappingProxyType(
|
||||
|
|
@ -371,7 +374,10 @@ def get_routes() -> tuple[str, ...]:
|
|||
def _route_ids(route: str, ids: Mapping[str, str]) -> Mapping[str, str]:
|
||||
"""``ids`` with the route's ``PARAMETER_ALIASES`` applied (``/v1/models/{model_id}`` takes a model name)."""
|
||||
aliases: Final = PARAMETER_ALIASES.get(route, {})
|
||||
return {**ids, **{name: ids[source] for name, source in aliases.items() if source in ids}}
|
||||
return {
|
||||
**{name: value for name, value in ids.items() if name not in aliases},
|
||||
**{name: ids[source] for name, source in aliases.items() if source in ids},
|
||||
}
|
||||
|
||||
|
||||
def _filled(route: str, ids: Mapping[str, str]) -> tuple[str, bool]:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue