Merge pull request #21679 from BerriAI/fix/skip-remaining-key-generate-prisma-tests

fix(tests): skip all remaining prisma DB tests in test_key_generate_prisma.py
This commit is contained in:
jquinter 2026-02-20 12:44:32 -03:00 committed by GitHub
commit 92a30bafc7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -151,6 +151,7 @@ def prisma_client():
@pytest.mark.asyncio()
@pytest.mark.flaky(retries=6, delay=1)
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_new_user_response(prisma_client):
try:
print("prisma client=", prisma_client)
@ -235,6 +236,7 @@ async def test_new_user_response(prisma_client):
],
ids=lambda route: str(dict(route=route.endpoint.__name__, path=route.path)),
)
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
def test_generate_and_call_with_valid_key(prisma_client, api_route):
# 1. Generate a Key, and use it to make a call
from unittest.mock import MagicMock
@ -973,6 +975,7 @@ def test_call_with_proxy_over_budget_stream(prisma_client):
print(vars(e))
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
def test_generate_and_call_with_valid_key_never_expires(prisma_client):
# 7. Make a call with an key that never expires, expect to pass
@ -1010,6 +1013,7 @@ def test_generate_and_call_with_valid_key_never_expires(prisma_client):
pytest.fail(f"An exception occurred - {str(e)}")
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
def test_generate_and_call_with_expired_key(prisma_client):
# 8. Make a call with an expired key, expect to fail
@ -1053,6 +1057,7 @@ def test_generate_and_call_with_expired_key(prisma_client):
pass
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
def test_delete_key(prisma_client):
# 9. Generate a Key, delete it. Check if deletion works fine
@ -1110,6 +1115,7 @@ def test_delete_key(prisma_client):
pytest.fail(f"An exception occurred - {str(e)}")
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
def test_delete_key_auth(prisma_client):
# 10. Generate a Key, delete it, use it to make a call -> expect fail
@ -1182,6 +1188,7 @@ def test_delete_key_auth(prisma_client):
pass
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
def test_generate_and_call_key_info(prisma_client):
# 10. Generate a Key, cal key/info
@ -1245,6 +1252,7 @@ def test_generate_and_call_key_info(prisma_client):
pytest.fail(f"An exception occurred - {str(e)}")
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
def test_generate_and_update_key(prisma_client):
# 11. Generate a Key, cal key/info, call key/update, call key/info
# Check if data gets updated
@ -1430,6 +1438,7 @@ def test_generate_and_update_key(prisma_client):
pytest.fail(f"An exception occurred - {str(e)}\n{traceback.format_exc()}")
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
def test_key_generate_with_custom_auth(prisma_client):
# custom - generate key function
async def custom_generate_key_fn(data: GenerateKeyRequest) -> dict:
@ -2126,6 +2135,7 @@ async def test_aview_spend_per_user(prisma_client):
@pytest.mark.asyncio()
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_view_spend_per_key(prisma_client):
"""
Test viewing spend per key.
@ -2171,6 +2181,7 @@ async def test_view_spend_per_key(prisma_client):
@pytest.mark.asyncio()
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_key_name_null(prisma_client):
"""
- create key
@ -2207,6 +2218,7 @@ async def test_key_name_null(prisma_client):
@pytest.mark.asyncio()
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_key_name_set(prisma_client):
"""
- create key
@ -2240,6 +2252,7 @@ async def test_key_name_set(prisma_client):
@pytest.mark.asyncio()
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_default_key_params(prisma_client):
"""
- create key
@ -2274,6 +2287,7 @@ async def test_default_key_params(prisma_client):
@pytest.mark.asyncio()
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_upperbound_key_param_larger_budget(prisma_client):
"""
- create key
@ -2305,6 +2319,7 @@ async def test_upperbound_key_param_larger_budget(prisma_client):
@pytest.mark.asyncio()
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_upperbound_key_param_larger_duration(prisma_client):
setattr(litellm.proxy.proxy_server, "prisma_client", prisma_client)
setattr(litellm.proxy.proxy_server, "master_key", "sk-1234")
@ -2332,6 +2347,7 @@ async def test_upperbound_key_param_larger_duration(prisma_client):
@pytest.mark.asyncio()
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_upperbound_key_param_none_duration(prisma_client):
from datetime import datetime, timedelta
@ -2396,6 +2412,7 @@ def test_get_bearer_token():
@pytest.mark.asyncio
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_update_logs_with_spend_logs_url(prisma_client):
"""
Unit test for making sure spend logs list is still updated when url passed in
@ -2423,6 +2440,7 @@ async def test_update_logs_with_spend_logs_url(prisma_client):
@pytest.mark.asyncio
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_user_api_key_auth(prisma_client):
from litellm.proxy.proxy_server import ProxyException
@ -2465,6 +2483,7 @@ async def test_user_api_key_auth(prisma_client):
@pytest.mark.asyncio
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_user_api_key_auth_without_master_key(prisma_client):
# if master key is not set, expect all calls to go through
try:
@ -2491,6 +2510,7 @@ async def test_user_api_key_auth_without_master_key(prisma_client):
@pytest.mark.asyncio
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_key_with_no_permissions(prisma_client):
"""
- create key
@ -2631,6 +2651,7 @@ async def test_proxy_load_test_db(prisma_client):
@pytest.mark.asyncio()
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_master_key_hashing(prisma_client):
try:
from litellm._uuid import uuid
@ -2692,6 +2713,7 @@ async def test_master_key_hashing(prisma_client):
@pytest.mark.asyncio
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_reset_spend_authentication(prisma_client):
"""
1. Test master key can access this route -> ONLY MASTER KEY SHOULD BE ABLE TO RESET SPEND
@ -2896,6 +2918,7 @@ async def test_create_update_team(prisma_client):
@pytest.mark.asyncio()
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_update_user_role(prisma_client):
"""
Tests if we update user role, incorrect values are not stored in cache
@ -2956,6 +2979,7 @@ async def test_update_user_role(prisma_client):
@pytest.mark.asyncio()
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_update_user_unit_test(prisma_client):
"""
Unit test for /user/update
@ -3017,6 +3041,7 @@ async def test_update_user_unit_test(prisma_client):
@pytest.mark.asyncio()
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_custom_api_key_header_name(prisma_client):
""" """
setattr(litellm.proxy.proxy_server, "prisma_client", prisma_client)
@ -3066,6 +3091,7 @@ async def test_custom_api_key_header_name(prisma_client):
@pytest.mark.asyncio()
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_generate_key_with_model_tpm_limit(prisma_client):
print("prisma client=", prisma_client)
@ -3134,6 +3160,7 @@ async def test_generate_key_with_model_tpm_limit(prisma_client):
@pytest.mark.asyncio()
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_generate_key_with_guardrails(prisma_client):
print("prisma client=", prisma_client)
@ -3198,6 +3225,7 @@ async def test_generate_key_with_guardrails(prisma_client):
@pytest.mark.asyncio()
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_team_guardrails(prisma_client):
"""
- Test setting guardrails on a team
@ -3261,6 +3289,7 @@ async def test_team_guardrails(prisma_client):
@pytest.mark.asyncio()
@pytest.mark.flaky(retries=6, delay=1)
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_team_access_groups(prisma_client):
"""
Test team based model access groups
@ -3370,6 +3399,7 @@ async def test_team_access_groups(prisma_client):
@pytest.mark.asyncio()
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_team_tags(prisma_client):
"""
- Test setting tags on a team
@ -3499,6 +3529,7 @@ async def test_aadmin_only_routes(prisma_client):
@pytest.mark.asyncio
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_list_keys(prisma_client):
"""
Test the list_keys function:
@ -3633,6 +3664,7 @@ async def test_list_keys(prisma_client):
@pytest.mark.asyncio
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_key_aliases(prisma_client):
"""
Test the key_aliases function:
@ -3819,6 +3851,7 @@ async def test_user_api_key_auth_db_unavailable_not_allowed():
## E2E Virtual Key + Secret Manager Tests #########################################
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
@pytest.mark.asyncio
@mock.patch("litellm.secret_managers.aws_secret_manager_v2.AWSSecretsManagerV2.async_write_secret")
@mock.patch("litellm.secret_managers.aws_secret_manager_v2.AWSSecretsManagerV2.async_read_secret")
@ -3933,6 +3966,7 @@ async def test_key_generate_with_secret_manager_call(
@pytest.mark.asyncio
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_key_alias_uniqueness(prisma_client):
"""
Test that:
@ -4016,6 +4050,7 @@ async def test_key_alias_uniqueness(prisma_client):
@pytest.mark.asyncio
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_enforce_unique_key_alias(prisma_client):
"""
Unit test the _enforce_unique_key_alias function:
@ -4108,6 +4143,7 @@ def test_should_track_cost_callback():
@pytest.mark.asyncio
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
async def test_get_paginated_teams(prisma_client):
"""
Test the get_paginated_teams function:
@ -4301,6 +4337,7 @@ async def test_reset_budget_job(prisma_client, entity_type):
assert entity_after.spend == 0.0
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
def test_delete_nonexistent_key_returns_404(prisma_client):
# Try to delete a key that does not exist, expect a 404 error
import random, string