Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

tests: mock LiteLLM_UserTable for CloudZero export

Yuta Saitobdc35b4cd273
diff --git a/tests/test_litellm/integrations/cloudzero/test_cloudzero.py b/tests/test_litellm/integrations/cloudzero/test_cloudzero.py
index db6726a234d..31a2f6cbf51 100644
--- a/tests/test_litellm/integrations/cloudzero/test_cloudzero.py
+++ b/tests/test_litellm/integrations/cloudzero/test_cloudzero.py
@@ -9,6 +9,7 @@ from litellm.integrations.cloudzero.cz_stream_api import CloudZeroStreamer
from litellm.integrations.cloudzero.database import LiteLLMDatabase
+
class TestCloudZeroHourlyExport:
@pytest.mark.asyncio
async def test_hourly_export(self):
@@ -50,6 +51,12 @@ class TestCloudZeroHourlyExport:
"token": ["sk-test-cloudzero-token-010"],
}
)
+ user_mock_data = pl.LazyFrame(
+ {
+ "user_id": ["069e8205-8f55-44fd-870b-0c036cab600c"],
+ "user_email": ["[email protected]"],
+ }
+ )
with (
patch.object(LiteLLMDatabase, "_ensure_prisma_client") as mock_prisma_client_getter,
@@ -64,6 +71,7 @@ class TestCloudZeroHourlyExport:
LiteLLM_DailyUserSpend=spend_mock_data,
LiteLLM_VerificationToken=verification_mock_data,
LiteLLM_TeamTable=team_mock_data,
+ LiteLLM_UserTable=user_mock_data,
)
result = sql_context.execute(query).collect()