Coverage for middle_layer/common/application_layer/rest_api/routes.py: 100.00%

10 statements  

« prev     ^ index     » next       coverage.py v7.10.5, created at 2026-03-09 06:13 +0000

1# Copyright 2024 Associated Universities, Inc. 

2# 

3# This file is part of Telescope Time Allocation Tools (TTAT). 

4# 

5# TTAT is free software: you can redistribute it and/or modify 

6# it under the terms of the GNU General Public License as published by 

7# the Free Software Foundation, either version 3 of the License, or 

8# any later version. 

9# 

10# TTAT is distributed in the hope that it will be useful, 

11# but WITHOUT ANY WARRANTY; without even the implied warranty of 

12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

13# GNU General Public License for more details. 

14# 

15# You should have received a copy of the GNU General Public License 

16# along with TTAT. If not, see <https://www.gnu.org/licenses/>. 

17# 

18from pyramid.config import Configurator 

19 

20 

21def includeme(config: Configurator): 

22 """ 

23 Function that gets included in server.py:main(); calls all route adding functions 

24 

25 :param config: Pyramid server config object 

26 """ 

27 default_routes(config) 

28 auth_routes(config) 

29 

30 

31def default_routes(config: Configurator): 

32 """ 

33 Uncategorized server routes 

34 

35 :param config: Pyramid server config object 

36 """ 

37 config.add_route(name="home", pattern="/") 

38 

39 

40def auth_routes(config: Configurator): 

41 """ 

42 server routes for authentication (and jwt's) 

43 :param config: Pyramid server config object 

44 """ 

45 config.add_route(name="issue_user_jwt", pattern="auth", request_method="POST") 

46 config.add_route("options_response", "/*subpath", request_method="OPTIONS") 

47 config.add_route(name="search_users", pattern="auth/{searchterm}", request_method="GET")