Skip to content

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]

test: patch CredentialsManagementClient in CLI (#12304)

Ishaan Jaff3ad6b36ffcbb
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