test(db): alias replica_db on daily-activity prisma fakes merged from main

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
yuneng 2026-09-25 00:12:28 +00:00
parent 2ce8d66ecd
commit de72a5a2b9
2 changed files with 4 additions and 0 deletions

View file

@ -2975,6 +2975,7 @@ def _team_spend_row(
def _export_prisma(conn: psycopg.Connection, token_rows: Sequence[SimpleNamespace] = ()) -> MagicMock:
mock_prisma = MagicMock()
mock_prisma.db = MagicMock()
mock_prisma.replica_db = mock_prisma.db
mock_prisma.db.query_raw = _psycopg_query_raw(conn, [])
mock_prisma.db.litellm_verificationtoken.find_many = AsyncMock(return_value=list(token_rows))
mock_prisma.db.litellm_deletedverificationtoken.find_many = AsyncMock(return_value=[])

View file

@ -2711,6 +2711,7 @@ async def test_search_user_daily_activity_keys_passes_matched_tokens_to_aggregat
)
mock_prisma_client = MagicMock()
mock_prisma_client.replica_db = mock_prisma_client.db
mock_prisma_client.db.litellm_verificationtoken.find_many = AsyncMock(
return_value=[SimpleNamespace(token="tok-a"), SimpleNamespace(token="tok-b")]
)
@ -2774,6 +2775,7 @@ async def test_search_user_daily_activity_keys_no_match_returns_empty_without_ag
)
mock_prisma_client = MagicMock()
mock_prisma_client.replica_db = mock_prisma_client.db
mock_prisma_client.db.litellm_verificationtoken.find_many = AsyncMock(return_value=[])
monkeypatch.setattr("litellm.proxy.proxy_server.prisma_client", mock_prisma_client)
@ -2818,6 +2820,7 @@ async def test_search_user_daily_activity_keys_non_admin_scoped_to_caller(monkey
)
mock_prisma_client = MagicMock()
mock_prisma_client.replica_db = mock_prisma_client.db
mock_prisma_client.db.litellm_verificationtoken.find_many = AsyncMock(return_value=[SimpleNamespace(token="tok-a")])
monkeypatch.setattr("litellm.proxy.proxy_server.prisma_client", mock_prisma_client)