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_delete_callbacks_in_db
Ishaan Jaffer1bf284abca92
diff --git a/tests/test_litellm/proxy/management_endpoints/test_delete_callbacks_endpoint.py b/tests/test_litellm/proxy/management_endpoints/test_delete_callbacks_endpoint.pyindex 161f5713f26..e38204fc909 100644--- a/tests/test_litellm/proxy/management_endpoints/test_delete_callbacks_endpoint.py+++ b/tests/test_litellm/proxy/management_endpoints/test_delete_callbacks_endpoint.py@@ -113,84 +113,3 @@ def mock_encrypt_value_helper(value, key=None, new_encryption_key=None):def mock_decrypt_value_helper(value, key=None, return_original_value=False):"""Mock decryption - just return the value as-is for testing"""return value---async def test_delete_callbacks_in_db(mock_prisma, mock_auth):-- # Create mock proxy_config- mock_proxy_config = MagicMock()- mock_proxy_config.get_config = AsyncMock(return_value={- "litellm_settings": {"success_callback": ["langfuse"]},- "environment_variables": {- "LANGFUSE_PUBLIC_KEY": "any-public-key",- "LANGFUSE_SECRET_KEY": "any-secret-key",- "LANGFUSE_HOST": "https://exampleopenaiendpoint-production-c715.up.railway.app",- },- })- mock_proxy_config.save_config = AsyncMock()- mock_proxy_config.add_deployment = AsyncMock()-- with patch("litellm.proxy.proxy_server.prisma_client", mock_prisma), \- patch("litellm.proxy.proxy_server.proxy_config", mock_proxy_config), \- patch("litellm.proxy.proxy_server.proxy_logging_obj", MagicMock()), \- patch("litellm.proxy.proxy_server.store_model_in_db", True), \- patch("litellm.proxy.proxy_server.encrypt_value_helper", side_effect=mock_encrypt_value_helper), \- patch("litellm.proxy.proxy_server.decrypt_value_helper", side_effect=mock_decrypt_value_helper):-- # Override auth dependency- app.dependency_overrides[- lambda: __import__("litellm.proxy.proxy_server", fromlist=["user_api_key_auth"]).user_api_key_auth- ] = lambda: mock_auth-- # Add langfuse callback to DB via /config/update- config_data = {- "litellm_settings": {"success_callback": ["langfuse"]},- "environment_variables": {- "LANGFUSE_PUBLIC_KEY": "any-public-key",- "LANGFUSE_SECRET_KEY": "any-secret-key",- "LANGFUSE_HOST": "https://exampleopenaiendpoint-production-c715.up.railway.app",- },- }-- config_response = client.post(- "/config/update",- json=config_data,- headers={"Authorization": "Bearer sk-1234"}- )- assert config_response.status_code == 200-- # Delete the langfuse callback- delete_data = {"callback_name": "langfuse"}- delete_response = client.post(- "/config/callback/delete",- json=delete_data,- headers={"Authorization": "Bearer sk-1234"}- )-- assert delete_response.status_code == 200- delete_result = delete_response.json()-- # Verify delete response- assert "message" in delete_result- assert "langfuse" in delete_result.get("removed_callback", "")- assert "langfuse" not in delete_result.get("remaining_callbacks", [])-- # Update mock to reflect deletion for get_config test- mock_prisma.remove_callback_from_config("langfuse")-- # Get config and verify callback is deleted- config_response = client.get(- "/get/config/callbacks",- headers={"Authorization": "Bearer sk-1234"}- )-- assert config_response.status_code == 200- config_data = config_response.json()-- # Verify callback is removed from the config- callback_names = [callback["name"] for callback in config_data.get("callbacks", [])]- assert "langfuse" not in callback_names-- # Clean up- app.dependency_overrides.clear()\ No newline at end of file