diff --git a/opentech/apply/tests/test_workflow.py b/opentech/apply/tests/test_workflow.py index f313d7173c23b887829634e22e4e1e31e327c40d..bd424b30ad375ae98324efbaa0efa8e39a06f301 100644 --- a/opentech/apply/tests/test_workflow.py +++ b/opentech/apply/tests/test_workflow.py @@ -58,7 +58,7 @@ class TestPhaseCreation(SimpleTestCase): name = 'the_phase' phase = Phase(name, actions) self.assertEqual(phase.name, name) - self.assertEqual(phase.actions, {action.name: action for action in actions}) + self.assertEqual(phase.actions, [action.name for action in actions]) def test_can_get_action_from_phase(self): actions = ActionFactory.create_batch(3) diff --git a/opentech/apply/workflow.py b/opentech/apply/workflow.py index 100393b30803857fa6d0282c12b8658bb0f7779d..5e27f0d4bc0203f1b062b3637da63f448436f6fe 100644 --- a/opentech/apply/workflow.py +++ b/opentech/apply/workflow.py @@ -63,14 +63,18 @@ class Phase: def __init__(self, name: str, actions: Sequence['Action']) -> None: self.name = name self.stage: Union['Stage', None] = None - self.actions = {action.name: action for action in actions} + self._actions= {action.name: action for action in actions} self.occurance: int = 0 + @property + def actions(self): + return list(self._actions.keys()) + def __str__(self): return '__'.join([self.stage.name, self.name, str(self.occurance)]) def __getitem__(self, value): - return self.actions[value] + return self._actions[value] class Action: