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

13 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 disposition_letter_routes(config) 

28 manage_template_routes(config) 

29 prototype_project_routes(config) 

30 

31 

32def disposition_letter_routes(config: Configurator): 

33 """ 

34 server routes for disposition letters 

35 

36 :param config: Pyramid server config object 

37 """ 

38 config.add_route( 

39 name="generate_disposition_letters", 

40 pattern=f"disposition_letters/generate", 

41 request_method="POST", 

42 ) 

43 config.add_route( 

44 name="send_disposition_letters", 

45 pattern=f"disposition_letters/send", 

46 request_method="POST", 

47 ) 

48 config.add_route( 

49 name="update_disposition_letter", 

50 pattern=f"disposition_letter/{{proposal_id}}", 

51 request_method="PUT", 

52 ) 

53 

54 

55def manage_template_routes(config: Configurator): 

56 """ 

57 server routes for managing templates 

58 

59 :param config: Pyramid server config object 

60 """ 

61 config.add_route( 

62 name="update_template", 

63 pattern="template", 

64 request_method="PUT", 

65 ) 

66 

67 

68def prototype_project_routes(config: Configurator): 

69 """ 

70 server routes for managing prototype projects 

71 :param config: 

72 :return: 

73 """ 

74 config.add_route( 

75 name="export_prototype_project", 

76 pattern=f"proposals/{{proposal_id}}/export_prototype_project", 

77 request_method="POST", 

78 )