From 44e305648de5779a47789bb5b71e84b7c3867a70 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 24 Mar 2025 15:33:02 -0700 Subject: [PATCH] test(test_spend_management_endpoints.py): add unit testing for router + spend logs --- .../spend_tracking/test_spend_management_endpoints.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/litellm/proxy/spend_tracking/test_spend_management_endpoints.py b/tests/litellm/proxy/spend_tracking/test_spend_management_endpoints.py index 6623e322eed..a5ee9ddf70d 100644 --- a/tests/litellm/proxy/spend_tracking/test_spend_management_endpoints.py +++ b/tests/litellm/proxy/spend_tracking/test_spend_management_endpoints.py @@ -580,7 +580,6 @@ class TestSpendLogsPayload: payload[key] == value ), f"Expected {key} to be {value}, but got {payload[key]}" - @pytest.mark.skip(reason="Test found bug, let's fix and repush.") @pytest.mark.asyncio async def test_spend_logs_payload_success_log_with_router(self): from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler @@ -597,6 +596,9 @@ class TestSpendLogsPayload: "litellm_params": { "model": "claude-3-7-sonnet-20250219", }, + "model_info": { + "id": "my-unique-model-id", + }, } ] ) @@ -609,7 +611,7 @@ class TestSpendLogsPayload: client, "post", side_effect=self.mock_anthropic_response ): response = await router.acompletion( - model="claude-3-7-sonnet-20250219", + model="my-anthropic-model-group", messages=[{"role": "user", "content": "Hello, world!"}], metadata={"user_api_key_end_user_id": "test_user_1"}, client=client, @@ -651,7 +653,7 @@ class TestSpendLogsPayload: "end_user": "test_user_1", "api_base": "https://api.anthropic.com/v1/messages", "model_group": "my-anthropic-model-group", - "model_id": "", + "model_id": "my-unique-model-id", "requester_ip_address": None, "custom_llm_provider": "anthropic", "messages": "{}",