Coverage for routers/subs/health.py: 80%

19 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-10 12:56 +0000

1from decouple import config 

2from fastapi import Depends 

3from fastapi import HTTPException, status 

4 

5import schemas 

6from chalicelib.core import health, tenants 

7from or_dependencies import OR_context 

8from routers.base import get_routers 

9 

10public_app, app, app_apikey = get_routers() 

11 

12 

13@app.get('/healthz', tags=["health-check"]) 

14def get_global_health_status(context: schemas.CurrentContext = Depends(OR_context)): 

15 if config("LOCAL_DEV", cast=bool, default=False): 15 ↛ 16line 15 didn't jump to line 16 because the condition on line 15 was never true

16 return {"data": ""} 

17 return {"data": health.get_health(context.tenant_id)} 

18 

19 

20if not tenants.tenants_exists_sync(use_pool=False): 20 ↛ exitline 20 didn't exit the module because the condition on line 20 was always true

21 @public_app.get('/health', tags=["health-check"]) 

22 async def get_public_health_status(): 

23 if await tenants.tenants_exists(): 23 ↛ 26line 23 didn't jump to line 26 because the condition on line 23 was always true

24 raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=f"Not Found") 

25 

26 return {"data": health.get_health()}