tests: mock LiteLLM_UserTable for CloudZero export

This commit is contained in:
Yuta Saito 2026-01-05 17:23:04 +09:00
parent b6664669d2
commit bdc35b4cd2

View file

@ -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": ["user@example.com"],
}
)
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()