Coverage for yaptide/routes/main_routes.py: 100%

34 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-22 07:31 +0000

1from flask_restful import Api, Resource 

2 

3from yaptide.routes.auth_routes import (AuthLogIn, AuthLogOut, AuthRefresh, AuthRegister, AuthStatus) 

4from yaptide.routes.batch_routes import Clusters, JobsBatch 

5from yaptide.routes.celery_routes import ConvertResource, JobsDirect 

6from yaptide.routes.common_sim_routes import (JobsResource, InputsResource, LogfilesResource, ResultsResource) 

7from yaptide.routes.estimator_routes import EstimatorResource 

8from yaptide.routes.keycloak_routes import AuthKeycloak 

9from yaptide.routes.task_routes import TasksResource 

10from yaptide.routes.user_routes import UserSimulations, UserUpdate 

11from yaptide.routes.utils.response_templates import yaptide_response 

12 

13 

14class HelloWorld(Resource): 

15 """Root route""" 

16 

17 @staticmethod 

18 def get(): 

19 """Root route get method""" 

20 return yaptide_response(message="Hello World!", code=200) 

21 

22 

23def initialize_routes(api: Api): 

24 """Function initializing routes""" 

25 api.add_resource(HelloWorld, "/") 

26 

27 api.add_resource(JobsDirect, "/jobs/direct") 

28 api.add_resource(JobsBatch, "/jobs/batch") 

29 

30 api.add_resource(JobsResource, "/jobs") 

31 

32 api.add_resource(TasksResource, "/tasks") 

33 

34 api.add_resource(ResultsResource, "/results") 

35 api.add_resource(InputsResource, "/inputs") 

36 api.add_resource(LogfilesResource, "/logfiles") 

37 

38 api.add_resource(ConvertResource, "/convert") 

39 

40 api.add_resource(UserSimulations, "/user/simulations") 

41 api.add_resource(UserUpdate, "/user/update") 

42 

43 api.add_resource(AuthRegister, "/auth/register") 

44 api.add_resource(AuthLogIn, "/auth/login") 

45 api.add_resource(AuthRefresh, "/auth/refresh") 

46 api.add_resource(AuthStatus, "/auth/status") 

47 api.add_resource(AuthLogOut, "/auth/logout") 

48 

49 api.add_resource(AuthKeycloak, "/auth/keycloak") 

50 

51 api.add_resource(Clusters, "/clusters") 

52 api.add_resource(EstimatorResource, "/estimators")