test(proxy): tighten get_spend_routes=false deny assertion

ruff-tests B017/PT011 rejected bare pytest.raises(Exception). Match the
sibling global-spend deny tests (Exception + match + assert).
This commit is contained in:
er-s-an 2026-10-18 09:23:22 +08:00
parent 63274fb42b
commit 9d8d17ec1a

View file

@ -2191,7 +2191,7 @@ def test_get_spend_routes_false_permission_denies_internal_user(route):
request = MagicMock(spec=Request)
request.query_params = {}
with pytest.raises(Exception):
with pytest.raises(Exception, match="Only proxy admin can be used to generate, delete, update") as exc_info:
RouteChecks.non_proxy_admin_allowed_routes_check(
user_obj=user_obj,
_user_role=LitellmUserRoles.INTERNAL_USER.value,
@ -2200,7 +2200,7 @@ def test_get_spend_routes_false_permission_denies_internal_user(route):
valid_token=valid_token,
request_data={},
)
assert "Only proxy admin" in str(exc_info.value)
@pytest.mark.parametrize("route", ["/audit", "/audit/some-log-id"])