litellm/tests/test_litellm/proxy/spend_tracking
Ishaan Jaff b281181448
fix(tests): isolate auth in spend logs and vertex passthrough tests (#21810)
* fix(tests): add app.dependency_overrides for auth in spend logs tests

test_ui_view_spend_logs_with_status, test_ui_view_spend_logs_with_model,
test_ui_view_spend_logs_with_model_id, and test_view_spend_logs_summarize_parameter
all send Bearer sk-test without mocking user_api_key_auth. When a prior test
in the same xdist worker sets master_key, the auth check fails for sk-test
and the test fails intermittently.

Fix: use app.dependency_overrides[ps.user_api_key_auth] to bypass auth,
same pattern as other tests in the same file.

* fix(tests): mock user_api_key_auth in test_vertex_passthrough_with_no_default_credentials

vertex_proxy_route calls user_api_key_auth internally. When a prior test in the
same xdist worker sets master_key, the auth check fails for the test request
and create_pass_through_route is never called, causing assert_called_once_with to fail.

Fix: patch user_api_key_auth as an AsyncMock in the with mock.patch() block.
2026-02-21 12:51:38 -08:00
..
test_cloudzero_endpoints.py Adding backend 2025-12-19 13:04:59 -08:00
test_spend_management_endpoints.py fix(tests): isolate auth in spend logs and vertex passthrough tests (#21810) 2026-02-21 12:51:38 -08:00
test_spend_query_optimization.py fix(sql): Optimize SpendLogs queries to use timestamp filtering for index usage (#17504) 2025-12-04 21:52:57 -08:00
test_spend_tracking_utils.py [Feature] UI - Logs: Show retry count for requests 2026-02-20 13:51:20 -08:00