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_recreate_prisma_client_successful_disconnect
Ishaan Jaff1358978abb4c
diff --git a/tests/test_litellm/proxy/db/test_prisma_client.py b/tests/test_litellm/proxy/db/test_prisma_client.pyindex 7a8129db21e..83f07253fc8 100644--- a/tests/test_litellm/proxy/db/test_prisma_client.py+++ b/tests/test_litellm/proxy/db/test_prisma_client.py@@ -44,8 +44,9 @@ async def test_recreate_prisma_client_successful_disconnect():# Mock the original prisma clientmock_prisma = AsyncMock()- # Create a PrismaWrapper instance- wrapper = PrismaWrapper(original_prisma=mock_prisma, iam_token_db_auth=False)+ # Create a mock PrismaWrapper instance+ wrapper = Mock()+ wrapper._original_prisma = mock_prisma# Configure disconnect to succeedmock_prisma.disconnect.return_value = None@@ -61,13 +62,15 @@ async def test_recreate_prisma_client_successful_disconnect():wrapper._original_prisma = mock_new_prismaawait mock_new_prisma.connect()- with patch.object(wrapper, 'recreate_prisma_client', mock_recreate_prisma_client):- # Call the method- await wrapper.recreate_prisma_client("postgresql://new:new@localhost:5432/new")-- # Verify that disconnect was called- mock_prisma.disconnect.assert_called_once()-- # Verify that the new client replaced the original- assert wrapper._original_prisma != mock_prisma- assert hasattr(wrapper._original_prisma, 'connect')\ No newline at end of file+ # Assign the mock method to the wrapper+ wrapper.recreate_prisma_client = mock_recreate_prisma_client++ # Call the method+ await wrapper.recreate_prisma_client("postgresql://new:new@localhost:5432/new")++ # Verify that disconnect was called+ mock_prisma.disconnect.assert_called_once()++ # Verify that the new client replaced the original+ assert wrapper._original_prisma != mock_prisma+ assert hasattr(wrapper._original_prisma, 'connect')\ No newline at end of file