mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
- 新增 aether-billing、aether-crypto、aether-wallet 独立 crate - aether-data 扩展 repository 层:announcements、auth_modules、billing、 candidate_selection、gemini_file_mappings、global_models、management_tokens、 oauth_providers、proxy_nodes、quota、users、wallet 等模块 - aether-gateway 新增 api/auth/billing/control/middleware/scheduler/usage/ video_tasks/hooks/maintenance/model_fetch/provider_transport 等功能模块 - 重构 executor decision 和 gateway state 为模块目录结构 - 新增 gateway router、frontdoor 路由层及对应测试 - Python 侧 API 路由重构,新增 compat/support 模块 - 前端 Logo 组件更新及 Provider 管理页面调整
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
import json
|
|
|
|
import httpx
|
|
import pytest
|
|
|
|
from src.core.vertex_auth import VertexAuthError, VertexAuthService
|
|
|
|
|
|
class _TimeoutAsyncClient:
|
|
def __init__(self, **_: object) -> None:
|
|
pass
|
|
|
|
async def __aenter__(self) -> "_TimeoutAsyncClient":
|
|
return self
|
|
|
|
async def __aexit__(self, exc_type: object, exc: object, tb: object) -> bool:
|
|
return False
|
|
|
|
async def post(self, *args: object, **kwargs: object) -> object:
|
|
raise httpx.ReadTimeout("")
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_vertex_auth_is_rust_only(
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
) -> None:
|
|
service = VertexAuthService(
|
|
json.dumps(
|
|
{
|
|
"client_email": "svc@example.iam.gserviceaccount.com",
|
|
"private_key": "not-used-in-test",
|
|
"project_id": "demo-project",
|
|
}
|
|
)
|
|
)
|
|
|
|
monkeypatch.setattr(service, "_create_jwt", lambda: "signed-jwt")
|
|
monkeypatch.setattr("src.core.vertex_auth.httpx.AsyncClient", _TimeoutAsyncClient)
|
|
|
|
with pytest.raises(VertexAuthError, match=r"仅支持 Rust executor"):
|
|
await service.get_access_token(httpx_client_kwargs={"timeout": 30})
|