diff --git a/litellm/integrations/bitbucket/bitbucket_client.py b/litellm/integrations/bitbucket/bitbucket_client.py index e4f5a50550e..7549bae6fcd 100644 --- a/litellm/integrations/bitbucket/bitbucket_client.py +++ b/litellm/integrations/bitbucket/bitbucket_client.py @@ -80,7 +80,7 @@ class BitBucketClient: self.repository = config.get("repository") self.access_token = config.get("access_token") self.branch = config.get("branch", "main") - self.base_url = config.get("", "https://api.bitbucket.org/2.0") + self.base_url = config.get("base_url", "https://api.bitbucket.org/2.0") self.auth_method = config.get("auth_method", "token") self.username = config.get("username") diff --git a/tests/unit/integrations/bitbucket/test_bitbucket_prompt_manager.py b/tests/unit/integrations/bitbucket/test_bitbucket_prompt_manager.py index a1a88653ee6..75afaeaaccd 100644 --- a/tests/unit/integrations/bitbucket/test_bitbucket_prompt_manager.py +++ b/tests/unit/integrations/bitbucket/test_bitbucket_prompt_manager.py @@ -2,7 +2,9 @@ import json import re from unittest.mock import MagicMock, patch +import httpx import pytest +import respx from litellm.integrations.bitbucket.bitbucket_client import BitBucketClient @@ -65,6 +67,25 @@ def test_bitbucket_client_initialization(): assert client_basic.username == "test-user" +def test_bitbucket_client_uses_configured_base_url(): + config = { + "workspace": "test-workspace", + "repository": "test-repo", + "access_token": "test-token", + "base_url": "https://bitbucket.example.com/2.0", + } + + with respx.mock: + respx.get( + "https://bitbucket.example.com/2.0/repositories/test-workspace/test-repo/src/main/prompts/test.prompt" + ).mock(return_value=httpx.Response(200, text="prompt", headers={"content-type": "text/plain"})) + client = BitBucketClient(config) + + content = client.get_file_content("prompts/test.prompt") + + assert content == "prompt" + + def test_bitbucket_client_missing_required_fields(): """Test BitBucketClient initialization with missing required fields.""" with pytest.raises(