fix: add filter_time_by parameter to spend query optimization tests, delete comment.

This commit is contained in:
Avgany-23 2026-08-12 22:42:13 +03:00
parent 5bcf3a44be
commit da5cab690e
2 changed files with 5 additions and 1 deletions

View file

@ -2305,7 +2305,6 @@ async def ui_view_spend_logs(
code=status.HTTP_400_BAD_REQUEST,
)
# Validate filter_time_by
valid_filter_fields: Final = ("startTime", "endTime")
if filter_time_by not in valid_filter_fields:
raise ProxyException(

View file

@ -194,6 +194,7 @@ async def test_spend_logs_ui_wraps_params_in_at_time_zone_utc(monkeypatch):
sort_by="startTime",
sort_order="desc",
user_api_key_dict=auth,
filter_time_by="startTime",
)
assert mock_prisma.db.query_raw.called, "query_raw should have been called"
@ -257,6 +258,7 @@ async def test_spend_logs_ui_uses_bounded_count_not_full_scan(monkeypatch):
sort_by="startTime",
sort_order="desc",
user_api_key_dict=auth,
filter_time_by="startTime",
)
mock_prisma.db.litellm_spendlogs.count.assert_not_called()
@ -321,6 +323,7 @@ async def test_spend_logs_ui_caps_total_for_large_result_sets(monkeypatch):
sort_by="startTime",
sort_order="desc",
user_api_key_dict=auth,
filter_time_by="startTime",
)
assert response["total"] == SPEND_LOGS_PAGINATION_COUNT_CAP
@ -366,6 +369,7 @@ async def test_spend_logs_ui_empty_page_reports_zero_total(monkeypatch):
sort_by="startTime",
sort_order="desc",
user_api_key_dict=auth,
filter_time_by="startTime",
)
mock_prisma.db.litellm_spendlogs.count.assert_not_called()
@ -413,6 +417,7 @@ async def test_spend_logs_ui_out_of_range_page_keeps_total(monkeypatch):
sort_by="startTime",
sort_order="desc",
user_api_key_dict=auth,
filter_time_by="startTime",
)
mock_prisma.db.litellm_spendlogs.count.assert_not_called()