mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
test: cover CLI SSO team sort key branches directly
This commit is contained in:
parent
9789a4a32e
commit
808a23710a
1 changed files with 20 additions and 0 deletions
|
|
@ -8391,3 +8391,23 @@ async def test_fetch_cli_sso_team_details_orders_by_alias_then_id():
|
|||
"Forge-Team-A-35551",
|
||||
"forge-team-b-35551",
|
||||
]
|
||||
|
||||
|
||||
def test_cli_sso_team_sort_key_case_insensitive_with_id_tiebreaker():
|
||||
"""Directly exercise the sort key, including the alias-None and team_id-None
|
||||
fallbacks, so ordering is stable regardless of how the DB row is shaped.
|
||||
"""
|
||||
from litellm.proxy.management_endpoints import ui_sso as ui_sso_mod
|
||||
|
||||
CliSsoTeamDetail = ui_sso_mod.CliSsoTeamDetail
|
||||
key = ui_sso_mod._cli_sso_team_sort_key
|
||||
|
||||
a = CliSsoTeamDetail(team_id="2", team_alias="Alpha", team_models=())
|
||||
b = CliSsoTeamDetail(team_id="1", team_alias="alpha", team_models=())
|
||||
c = CliSsoTeamDetail(team_id=None, team_alias=None, team_models=())
|
||||
|
||||
# Both `or ""` fallbacks are taken for c.
|
||||
assert key(c) == ("", "")
|
||||
# Case-insensitive alias equality falls back to team_id ("1" < "2");
|
||||
# the alias-less team sorts first.
|
||||
assert [t.team_id for t in sorted([a, b, c], key=key)] == [None, "1", "2"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue