Coverage for tests/test_microservice_websocket/test_utils/test_util_enums.py: 100%

8 statements  

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

1import pytest 

2 

3from microservice_websocket.app.utils.enums import NodeState 

4 

5 

6def test_to_irma_ui_state(): 

7 expected = [ 

8 (NodeState.ERROR, "off"), 

9 (NodeState.READY, "ok"), 

10 (NodeState.RUNNING, "rec"), 

11 (NodeState.ALERT_READY, "alert-ready"), 

12 (NodeState.ALERT_RUNNING, "alert-running"), 

13 ] 

14 

15 for state, result in expected: 

16 assert ( 

17 NodeState.to_irma_ui_state(state) == result 

18 ), "Invalid conversion of NodeState to ui string" 

19 

20 with pytest.raises(ValueError): 

21 NodeState.to_irma_ui_state(NodeState.ALERT_RUNNING + 1)