Coverage for routers/base.py: 100%

10 statements  

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

1from fastapi import APIRouter, Depends 

2 

3from auth.auth_apikey import APIKeyAuth 

4from auth.auth_jwt import JWTAuth 

5from auth.auth_project import ProjectAuthorizer 

6from or_dependencies import ORRoute 

7 

8 

9def get_routers(prefix="", extra_dependencies=[], tags=[]) -> (APIRouter, APIRouter, APIRouter): 

10 public_app = APIRouter(route_class=ORRoute, prefix=prefix, tags=tags) 

11 app = APIRouter(dependencies=[Depends(JWTAuth()), Depends(ProjectAuthorizer("projectId"))] + extra_dependencies, 

12 route_class=ORRoute, prefix=prefix, tags=tags) 

13 app_apikey = APIRouter( 

14 dependencies=[Depends(APIKeyAuth()), Depends(ProjectAuthorizer("projectKey"))] + extra_dependencies, 

15 route_class=ORRoute, prefix=prefix, tags=tags) 

16 return public_app, app, app_apikey