From 6a6e5877d9c74d21034e762ecaced5f61af0540e Mon Sep 17 00:00:00 2001 From: ryan-crabbe-berri Date: Thu, 20 Aug 2026 20:12:29 -0700 Subject: [PATCH] test: satisfy the test-quality gates upstream added under ruff-tests and TQ002 --- tests/test_litellm/proxy/auth/test_auth_exception_handler.py | 2 +- .../management_endpoints/test_key_management_endpoints.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_litellm/proxy/auth/test_auth_exception_handler.py b/tests/test_litellm/proxy/auth/test_auth_exception_handler.py index ce180741375..2d0100340a2 100644 --- a/tests/test_litellm/proxy/auth/test_auth_exception_handler.py +++ b/tests/test_litellm/proxy/auth/test_auth_exception_handler.py @@ -541,7 +541,7 @@ async def test_auth_failure_on_a_key_route_does_not_hand_the_key_to_the_failure_ "litellm.proxy.proxy_server.general_settings", {"allow_requests_on_db_unavailable": False}, ): - with pytest.raises(Exception): + with pytest.raises(ProxyException): await handler._handle_authentication_error( HTTPException(status_code=401, detail="Invalid proxy server token passed"), MagicMock(), diff --git a/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py index 73ad68af39a..7e09ce48e41 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py +++ b/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py @@ -17299,11 +17299,12 @@ async def test_key_budgets_never_read_the_proxy_budget_row_for_a_caller_who_may_ _budgets_world(**_fully_populated_world()), patch(f"{_BUDGETS_RESOLVER}.UserRepository", user_repository), ): - await resolve_key_budgets( + budgets = await resolve_key_budgets( valid_token=_budgets_token(), end_user_id=None, deps=_budgets_deps(proxy_spend_visible=False) ) user_repository.return_value.find_by_id.assert_not_awaited() + assert next(e for e in budgets if e.scope == "proxy").spend_state == "restricted" @pytest.mark.parametrize(