mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
Merge branch 'main' into litellm_fix_service_account_behavior
This commit is contained in:
commit
4ddca7a79c
18 changed files with 518 additions and 194 deletions
|
@ -1485,21 +1485,18 @@ from litellm.proxy.utils import ProxyUpdateSpend
|
|||
async def test_end_user_transactions_reset():
|
||||
# Setup
|
||||
mock_client = MagicMock()
|
||||
mock_client.end_user_list_transactions = {"1": 10.0} # Bad log
|
||||
end_user_list_transactions = {"1": 10.0} # Bad log
|
||||
mock_client.db.tx = AsyncMock(side_effect=Exception("DB Error"))
|
||||
|
||||
# Call function - should raise error
|
||||
with pytest.raises(Exception):
|
||||
await ProxyUpdateSpend.update_end_user_spend(
|
||||
n_retry_times=0, prisma_client=mock_client, proxy_logging_obj=MagicMock()
|
||||
n_retry_times=0,
|
||||
prisma_client=mock_client,
|
||||
proxy_logging_obj=MagicMock(),
|
||||
end_user_list_transactions=end_user_list_transactions,
|
||||
)
|
||||
|
||||
# Verify cleanup happened
|
||||
assert (
|
||||
mock_client.end_user_list_transactions == {}
|
||||
), "Transactions list should be empty after error"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_spend_logs_cleanup_after_error():
|
||||
# Setup test data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue