feat(cloud): support Anthropic provider base URL
Tests / Test passed: 665

This commit is contained in:
2026-07-14 07:58:38 +08:00
parent 8b7e5a2800
commit 9250254dec
13 changed files with 124 additions and 39 deletions
@@ -136,6 +136,29 @@ def test_provider_profile_requires_admin_scope(monkeypatch) -> None:
)
def test_anthropic_profile_accepts_custom_base_url(monkeypatch) -> None:
from cryptography.fernet import Fernet
monkeypatch.setenv(
"CLOUD_LLM_PROVIDER_ENCRYPTION_KEY", Fernet.generate_key().decode()
)
app = create_app(config=CloudControlConfig(database_url="sqlite:///:memory:"))
with TestClient(app) as client:
_create_admin(client)
response = client.post(
"/v1/planner/providers",
headers=_csrf_headers(client),
json=_profile_payload(
name="Anthropic proxy",
provider_type="anthropic",
base_url="https://anthropic-proxy.example/",
),
)
assert response.status_code == 201, response.text
assert response.json()["base_url"] == "https://anthropic-proxy.example"
def test_profile_write_requires_encryption_key(monkeypatch) -> None:
monkeypatch.delenv("CLOUD_LLM_PROVIDER_ENCRYPTION_KEY", raising=False)
app = create_app(config=CloudControlConfig(database_url="sqlite:///:memory:"))