fix tests
This commit is contained in:
@@ -20,7 +20,8 @@ from src.core.SeriesApp import SeriesApp
|
||||
from src.server.services.auth_service import AuthError, auth_service
|
||||
|
||||
# Security scheme for JWT authentication
|
||||
security = HTTPBearer()
|
||||
# Use auto_error=False to handle errors manually and return 401 instead of 403
|
||||
security = HTTPBearer(auto_error=False)
|
||||
|
||||
|
||||
# Global SeriesApp instance
|
||||
@@ -99,7 +100,7 @@ async def get_database_session() -> AsyncGenerator:
|
||||
|
||||
|
||||
def get_current_user(
|
||||
credentials: HTTPAuthorizationCredentials = Depends(security)
|
||||
credentials: Optional[HTTPAuthorizationCredentials] = Depends(security),
|
||||
) -> dict:
|
||||
"""
|
||||
Dependency to get current authenticated user.
|
||||
@@ -128,7 +129,7 @@ def get_current_user(
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail=str(e),
|
||||
)
|
||||
) from e
|
||||
|
||||
|
||||
def require_auth(
|
||||
|
||||
Reference in New Issue
Block a user