105cf82d21
- 恢复 CelerySettings 和相关计算属性 - 修复 celery/app.py 调用 configure_celery_app 参数 - 创建 core/initialization/init_data.py stub - 删除不完整的 test_auth_supabase_gateway.py
42 lines
1.0 KiB
Python
42 lines
1.0 KiB
Python
from __future__ import annotations
|
|
|
|
import pytest
|
|
from pydantic import ValidationError
|
|
|
|
from v1.auth.schemas import (
|
|
AuthTokenResponse,
|
|
AuthUser,
|
|
LoginRequest,
|
|
RefreshRequest,
|
|
SignupRequest,
|
|
)
|
|
|
|
|
|
def test_signup_requires_valid_email() -> None:
|
|
with pytest.raises(ValidationError):
|
|
SignupRequest(email="not-an-email", password="secret123")
|
|
|
|
|
|
def test_login_requires_valid_email() -> None:
|
|
with pytest.raises(ValidationError):
|
|
LoginRequest(email="invalid", password="secret123")
|
|
|
|
|
|
def test_refresh_requires_token() -> None:
|
|
with pytest.raises(ValidationError):
|
|
RefreshRequest(refresh_token="")
|
|
|
|
|
|
def test_auth_token_response_maps_user() -> None:
|
|
user = AuthUser(id="user-1", email="user@example.com")
|
|
response = AuthTokenResponse(
|
|
access_token="access",
|
|
refresh_token="refresh",
|
|
expires_in=3600,
|
|
token_type="bearer",
|
|
user=user,
|
|
)
|
|
|
|
assert response.user.id == "user-1"
|
|
assert response.user.email == "user@example.com"
|