feat(backend): 重构 HTTP 错误处理为 RFC7807 标准并优化多个 service
This commit is contained in:
@@ -3,7 +3,7 @@ from __future__ import annotations
|
||||
from uuid import UUID
|
||||
|
||||
import pytest
|
||||
from fastapi import HTTPException
|
||||
from core.http.errors import ApiProblemError
|
||||
|
||||
from core.auth.jwt_verifier import TokenValidationError
|
||||
import v1.users.dependencies as deps
|
||||
@@ -49,7 +49,7 @@ async def test_get_current_user_raises_401_when_fallback_fails(monkeypatch) -> N
|
||||
|
||||
monkeypatch.setattr(deps, "_verify_user_with_supabase", _fallback)
|
||||
|
||||
with pytest.raises(HTTPException) as exc:
|
||||
with pytest.raises(ApiProblemError) as exc:
|
||||
await deps.get_current_user(authorization="Bearer invalid-token")
|
||||
|
||||
assert exc.value.status_code == 401
|
||||
|
||||
Reference in New Issue
Block a user