Coverage for app/api/routes/utils.py: 71%

14 statements  

« prev     ^ index     » next       coverage.py v7.16.1, created at 2026-10-26 10:48 +0000

1from fastapi import APIRouter, Depends 

2from pydantic.networks import EmailStr 

3 

4from app.api.deps import get_current_active_superuser 

5from app.models import Message 

6from app.utils import generate_test_email, send_email 

7 

8router = APIRouter(prefix="/utils", tags=["utils"]) 

9 

10 

11@router.post( 

12 "/test-email/", 

13 dependencies=[Depends(get_current_active_superuser)], 

14 status_code=201, 

15) 

16def test_email(email_to: EmailStr) -> Message: 

17 """ 

18 Test emails. 

19 """ 

20 email_data = generate_test_email(email_to=email_to) 

21 send_email( 

22 email_to=email_to, 

23 subject=email_data.subject, 

24 html_content=email_data.html_content, 

25 ) 

26 return Message(message="Test email sent") 

27 

28 

29@router.get("/health-check/") 

30async def health_check() -> bool: 

31 return True