From 3ad6b36ffcbb52e47fbce1a18ed6ae86c05db874 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Thu, 3 Jul 2025 17:01:50 -0700 Subject: [PATCH] test: patch CredentialsManagementClient in CLI (#12304) --- .../proxy/client/cli/test_credentials_commands.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_litellm/proxy/client/cli/test_credentials_commands.py b/tests/test_litellm/proxy/client/cli/test_credentials_commands.py index 9ad2bd067f3..2295ad6f2d9 100644 --- a/tests/test_litellm/proxy/client/cli/test_credentials_commands.py +++ b/tests/test_litellm/proxy/client/cli/test_credentials_commands.py @@ -17,10 +17,16 @@ from litellm.proxy.client.cli.main import cli @pytest.fixture def mock_credentials_client(): + """Patch the CredentialsManagementClient used by the CLI commands.""" with patch( - "litellm.proxy.client.cli.commands.credentials.CredentialsManagementClient" - ) as mock: - yield mock + "litellm.proxy.client.credentials.CredentialsManagementClient" + ) as root_patch: + # Ensure the reference used inside the CLI module also points to the mock + with patch( + "litellm.proxy.client.cli.commands.credentials.CredentialsManagementClient", + root_patch, + ) as cli_patch: + yield cli_patch @pytest.fixture