From c779d8e60752ec745a48ee3a872ba9a08c8181d8 Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Fri, 15 Dec 2017 15:46:11 +0000
Subject: [PATCH] Make accessing the list of actions easy from the phase

---
 opentech/apply/tests/test_workflow.py | 2 +-
 opentech/apply/workflow.py            | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/opentech/apply/tests/test_workflow.py b/opentech/apply/tests/test_workflow.py
index f313d7173..bd424b30a 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 100393b30..5e27f0d4b 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:
-- 
GitLab