From 44b378c416cf46d8d9959e370ecad8005273d864 Mon Sep 17 00:00:00 2001 From: Gyanu Date: Sun, 23 Aug 2026 14:41:39 +0530 Subject: [PATCH] Assert reservation payload in unpriced-settle tests. The new tests only inspected mocks, which the test-quality gate treats as mock-echo. --- .../proxy/hooks/test_proxy_track_cost_callback.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_litellm/proxy/hooks/test_proxy_track_cost_callback.py b/tests/test_litellm/proxy/hooks/test_proxy_track_cost_callback.py index 846bacac224..3b9f88900c0 100644 --- a/tests/test_litellm/proxy/hooks/test_proxy_track_cost_callback.py +++ b/tests/test_litellm/proxy/hooks/test_proxy_track_cost_callback.py @@ -438,6 +438,9 @@ async def test_track_cost_callback_settles_budget_reservation_when_response_cost ) mock_update_database.assert_not_called() mock_proxy_logging.failed_tracking_alert.assert_called() + # The hold is converted, not dropped: later traffic still sees the reserved cost. + assert budget_reservation["reserved_cost"] == 0.5 + assert budget_reservation.get("finalized") is not True @pytest.mark.asyncio @@ -497,6 +500,8 @@ async def test_track_cost_callback_settles_async_stream_when_response_cost_missi ) mock_update_database.assert_not_called() mock_proxy_logging.failed_tracking_alert.assert_called() + assert budget_reservation["reserved_cost"] == 0.5 + assert budget_reservation.get("finalized") is not True @pytest.mark.asyncio @@ -592,6 +597,9 @@ async def test_track_cost_callback_releases_budget_reservation_for_non_model_cal mock_release_budget_reservation.assert_awaited_once_with( budget_reservation=budget_reservation, ) + # Health checks refund the hold; they must not stamp it settled. + assert budget_reservation.get("finalized") is not True + assert budget_reservation["reserved_cost"] == 0.5 def test_get_budget_reservation_from_metadata_handles_dict_auth_object():