Coverage for microservice_websocket/app/utils/admin.py: 75%

6 statements  

« prev     ^ index     » next       coverage.py v7.0.0, created at 2022-12-20 14:31 +0000

1from fastapi import HTTPException, status 

2 

3from ..services.database.models import User 

4 

5 

6def verify_admin(user: User): 

7 not_an_admin_exception = HTTPException( 

8 status_code=status.HTTP_401_UNAUTHORIZED, detail="Admin Privileges Required" 

9 ) 

10 

11 if user.role != "admin": 11 ↛ 12line 11 didn't jump to line 12, because the condition on line 11 was never true

12 raise not_an_admin_exception