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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(organization): assert rejected values write nothing to the DB
ryan-crabbe-berri7a717740dd9b
diff --git a/tests/test_litellm/proxy/management_endpoints/test_organization_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_organization_endpoints.pyindex f9fe4b8af5a..2422b2ae5aa 100644--- a/tests/test_litellm/proxy/management_endpoints/test_organization_endpoints.py+++ b/tests/test_litellm/proxy/management_endpoints/test_organization_endpoints.py@@ -821,7 +821,8 @@ async def test_v2_rejects_negative_integer_limits(monkeypatch: pytest.MonkeyPatcfrom litellm.proxy._types import LitellmUserRoles, OrganizationUpdateRequestV2, UserAPIKeyAuthfrom litellm.proxy.management_endpoints.organization_endpoints import update_organization_v2- monkeypatch.setattr("litellm.proxy.proxy_server.prisma_client", AsyncMock())+ prisma_mock = AsyncMock()+ monkeypatch.setattr("litellm.proxy.proxy_server.prisma_client", prisma_mock)auth = UserAPIKeyAuth(user_role=LitellmUserRoles.PROXY_ADMIN, user_id="admin-1")with pytest.raises(HTTPException) as exc:@@ -832,6 +833,9 @@ async def test_v2_rejects_negative_integer_limits(monkeypatch: pytest.MonkeyPatc)assert exc.value.status_code == 422assert field in str(exc.value.detail)+ prisma_mock.db.tx.assert_not_called()+ prisma_mock.db.litellm_budgettable.update.assert_not_awaited()+ prisma_mock.db.litellm_organizationtable.update.assert_not_awaited()@pytest.mark.asyncio@@ -841,7 +845,8 @@ async def test_v2_rejects_unparseable_budget_duration(monkeypatch: pytest.Monkeyfrom litellm.proxy._types import LitellmUserRoles, OrganizationUpdateRequestV2, UserAPIKeyAuthfrom litellm.proxy.management_endpoints.organization_endpoints import update_organization_v2- monkeypatch.setattr("litellm.proxy.proxy_server.prisma_client", AsyncMock())+ prisma_mock = AsyncMock()+ monkeypatch.setattr("litellm.proxy.proxy_server.prisma_client", prisma_mock)auth = UserAPIKeyAuth(user_role=LitellmUserRoles.PROXY_ADMIN, user_id="admin-1")with pytest.raises(HTTPException) as exc:@@ -852,6 +857,9 @@ async def test_v2_rejects_unparseable_budget_duration(monkeypatch: pytest.Monkey)assert exc.value.status_code == 422assert "budget_duration" in str(exc.value.detail)+ prisma_mock.db.tx.assert_not_called()+ prisma_mock.db.litellm_budgettable.update.assert_not_awaited()+ prisma_mock.db.litellm_organizationtable.update.assert_not_awaited()@pytest.mark.asyncio