Coverage for microservice_websocket/app/utils/enums.py: 100%

32 statements  

« prev     ^ index     » next       coverage.py v7.0.0, created at 2022-12-20 18:11 +0000

1from enum import IntEnum, auto 

2 

3 

4class NodeState(IntEnum): 

5 ERROR = 0 

6 READY = auto() 

7 RUNNING = auto() 

8 ALERT_READY = auto() 

9 ALERT_RUNNING = auto() 

10 

11 @classmethod 

12 def to_irma_ui_state(cls, n: int) -> str: 

13 if n == 0: 

14 return "off" 

15 elif n == 1: 

16 return "ok" 

17 elif n == 2: 

18 return "rec" 

19 elif n == 3: 

20 return "alert-ready" 

21 elif n == 4: 

22 return "alert-running" 

23 else: 

24 raise ValueError 

25 

26 

27class CommandType(IntEnum): 

28 START_REC = 0 

29 STOP_REC = auto() 

30 SET_DEMO_1 = auto() 

31 SET_DEMO_2 = auto() 

32 

33 

34class EventType(IntEnum): 

35 START_REC = 0 

36 STOP_REC = auto() 

37 RAISE_ALERT = auto() 

38 HANDLE_ALERT = auto() 

39 KEEP_ALIVE = auto() 

40 ON_LAUNCH = auto()