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]

TestEncryptResponseId

Ishaan Jaffer6122ff9fce91
diff --git a/tests/test_litellm/integrations/gitlab/test_gitlab_prompt_manager.py b/tests/test_litellm/integrations/gitlab/test_gitlab_prompt_manager.py
index 637b2a5ae51..d623dba0c34 100644
--- a/tests/test_litellm/integrations/gitlab/test_gitlab_prompt_manager.py
+++ b/tests/test_litellm/integrations/gitlab/test_gitlab_prompt_manager.py
@@ -818,27 +818,3 @@ def test_cache_get_by_file_returns_exact_entry(mock_pm_cls, fake_managers):
assert beta and beta["id"] == "nested/beta"
-@patch("litellm.integrations.gitlab.gitlab_prompt_manager.GitLabClient")
-@patch("litellm.integrations.gitlab.gitlab_prompt_manager.GitLabPromptManager")
-def test_encode_decode_helpers_roundtrip_in_cache_context(mock_pm_cls, mock_client_cls, fake_managers):
- """Test that encode/decode helpers work correctly in the cache context."""
- tm, wrapper = fake_managers
- tm._discoverable_ids = ["dir1/dir2/item"]
- mock_pm_cls.return_value = wrapper
-
- cache = GitLabPromptCache({"project": "g/s/r", "access_token": "tkn"})
- cache.load_all()
-
- # Verify mock was used
- mock_pm_cls.assert_called_once()
-
- encoded = encode_prompt_id("dir1/dir2/item")
- assert encoded in cache.list_ids()
-
- # decode -> encode -> lookup should still work
- decoded = decode_prompt_id(encoded)
- assert decoded == "dir1/dir2/item"
-
- got = cache.get_by_id(decoded)
- assert got is not None
- assert got["id"] == "dir1/dir2/item"
\ No newline at end of file
diff --git a/tests/test_litellm/test_responses_id_security.py b/tests/test_litellm/test_responses_id_security.py
index 67b0afcadd9..6b04479326e 100644
--- a/tests/test_litellm/test_responses_id_security.py
+++ b/tests/test_litellm/test_responses_id_security.py
@@ -136,10 +136,9 @@ class TestEncryptResponseId:
)
with patch(
- "litellm.proxy.hooks.responses_id_security.encrypt_value_helper"
- ) as mock_encrypt:
- mock_encrypt.return_value = "encrypted_value_456"
-
+ "litellm.proxy.common_utils.encrypt_decrypt_utils._get_salt_key",
+ return_value="test-salt-key"
+ ):
with patch.object(
responses_id_security, "_get_signing_key", return_value="test-key"
):
@@ -147,9 +146,9 @@ class TestEncryptResponseId:
mock_response, mock_user_api_key_dict
)
- assert result.id == "resp_encrypted_value_456"
assert result.id.startswith("resp_")
- mock_encrypt.assert_called_once()
+ # The encrypted ID should be different from the original
+ assert result.id != "resp_456"
class TestCheckUserAccessToResponseId: