Coverage for postrfp/web/apps/ref.py: 95%

19 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-10-22 21:34 +0000

1import logging 

2 

3from webob import Response 

4 

5from postrfp.auth.policy import PassthroughPolicy 

6from postrfp.web.suxint import Sux 

7from postrfp.web.base import WSGIApp 

8 

9 

10log = logging.getLogger(__name__) 

11 

12 

13ref_sux = Sux( 

14 "postrfp.ref.handlers", 

15 "postrfp.web.adaptors.ref", 

16 models_module="postrfp.shared.serial.refmodels", 

17 api_name="PostRFP Ref API", 

18 description="Content Management API Endpoints ", 

19) 

20 

21 

22class RefApp(WSGIApp): 

23 """ 

24 Finite State Machine Web Application 

25 """ 

26 

27 routes = {} 

28 

29 def __init__(self, **kwargs): 

30 if not kwargs.get("auth_policy", None): 

31 kwargs["auth_policy"] = PassthroughPolicy() 

32 super().__init__(**kwargs) 

33 

34 def validate_user(self, request): 

35 pass 

36 

37 def build_sux(self): 

38 self.sux_instance = ref_sux 

39 

40 

41@RefApp.route("/status") 

42def status(request): 

43 """ 

44 Check that the app is running. 

45 

46 In auth/webapp so there is no authentication so this endpoint can be called 

47 from uptime monitoring tools 

48 """ 

49 return Response(body="ok", content_type="text/plain")