mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-16 09:22:22 +00:00
Merge e8683d1eaf into c36acd6e29
This commit is contained in:
commit
f4040f3719
2 changed files with 25 additions and 2 deletions
|
|
@ -96,7 +96,10 @@ class BitBucketClient:
|
|||
- repository: Repository name
|
||||
- access_token: BitBucket access token (or app password)
|
||||
- branch: Branch to fetch from (default: main)
|
||||
- base_url: Custom BitBucket API base URL (optional)
|
||||
- base_url: Custom BitBucket API base URL (optional). Must stay
|
||||
compatible with the Bitbucket Cloud 2.0 path scheme; Bitbucket Data
|
||||
Center (Server) REST APIs use different paths and are not supported
|
||||
by this client.
|
||||
- auth_method: Authentication method ('token' or 'basic', default: 'token')
|
||||
- username: Username for basic auth (optional)
|
||||
"""
|
||||
|
|
@ -104,7 +107,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")
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from unittest.mock import MagicMock, patch
|
|||
|
||||
import httpx
|
||||
import pytest
|
||||
import respx
|
||||
|
||||
|
||||
from litellm.integrations.bitbucket.bitbucket_client import BitBucketClient
|
||||
|
|
@ -67,6 +68,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(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue