fix:test_encode_decode_helpers_roundtrip_in_cache_context

This commit is contained in:
Sameer Kankute 2026-01-07 16:08:54 +05:30
parent 7b07b57cdc
commit 35571708ba

View file

@ -1,18 +1,19 @@
import os
import sys
from unittest.mock import MagicMock, patch
import pytest
sys.path.insert(0, os.path.abspath("../../..")) # Adds the parent directory to the system path
from litellm.integrations.gitlab.gitlab_client import GitLabClient
from litellm.integrations.gitlab.gitlab_prompt_manager import (
GitLabPromptCache,
GitLabPromptManager,
GitLabPromptTemplate,
GitLabTemplateManager,
GitLabPromptCache,
encode_prompt_id,
decode_prompt_id,
encode_prompt_id,
)
# -----------------------
@ -817,11 +818,16 @@ 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_client.GitLabClient")
@patch("litellm.integrations.gitlab.gitlab_prompt_manager.GitLabPromptManager")
def test_encode_decode_helpers_roundtrip_in_cache_context(mock_pm_cls, fake_managers):
def test_encode_decode_helpers_roundtrip_in_cache_context(mock_pm_cls, mock_client_cls, fake_managers):
tm, wrapper = fake_managers
tm._discoverable_ids = ["dir1/dir2/item"]
mock_pm_cls.return_value = wrapper
# Mock the GitLabClient to avoid real HTTP requests
mock_client = MagicMock()
mock_client_cls.return_value = mock_client
cache = GitLabPromptCache({"project": "g/s/r", "access_token": "tkn"})
cache.load_all()