Spaces:
Running
Running
Download tests/config/test_fixed_cloud_endpoints.py from dherain24/claude-proxy: direct link, hf CLI and curl.
- Browser
- Download file 2.05 kB
-
https://huggingface.co/spaces/dherain24/claude-proxy/resolve/main/tests/config/test_fixed_cloud_endpoints.py
- Command line
-
hf download hf://spaces/dherain24/claude-proxy/tests/config/test_fixed_cloud_endpoints.py
-
curl -L -o test_fixed_cloud_endpoints.py https://huggingface.co/spaces/dherain24/claude-proxy/resolve/main/tests/config/test_fixed_cloud_endpoints.py
2.05 kB
| import pytest | |
| from fastapi.testclient import TestClient | |
| from free_claude_code.config.loader import compose_settings_snapshot | |
| from free_claude_code.config.provider_catalog import PROVIDER_CATALOG | |
| from free_claude_code.providers.runtime.config import build_provider_config | |
| from tests.api.support import create_test_app | |
| def test_retired_url_cannot_override_cloud_endpoint(provider_id, retired_key, source): | |
| descriptor = PROVIDER_CATALOG[provider_id] | |
| assert descriptor.credential_env is not None | |
| managed = {descriptor.credential_env: "test-key"} | |
| process = {} | |
| if source in {"managed", "both"}: | |
| managed[retired_key] = "https://saved-custom.example/v1" | |
| if source in {"process", "both"}: | |
| process[retired_key] = "https://process-custom.example/v1" | |
| settings = compose_settings_snapshot(managed, process).settings | |
| config = build_provider_config(descriptor, settings) | |
| assert config.base_url == descriptor.default_base_url | |
| assert config.api_key == "test-key" | |
| def test_admin_exposes_only_resource_region_and_local_base_urls(): | |
| with TestClient( | |
| create_test_app(), base_url="http://127.0.0.1", client=("127.0.0.1", 50000) | |
| ) as client: | |
| response = client.get("/admin/api/config") | |
| assert response.status_code == 200 | |
| keys = {field["key"] for field in response.json()["fields"]} | |
| assert not keys.intersection( | |
| { | |
| "TOKENROUTER_BASE_URL", | |
| "NARAROUTE_BASE_URL", | |
| "LIGHTNING_BASE_URL", | |
| "EXPLABS_BASE_URL", | |
| } | |
| ) | |
| assert { | |
| "AZURE_OPENAI_BASE_URL", | |
| "BEDROCK_BASE_URL", | |
| "LM_STUDIO_BASE_URL", | |
| "LLAMACPP_BASE_URL", | |
| "OLLAMA_BASE_URL", | |
| } <= keys | |