def test_metromap_initial_state(self): """A newly created Case is in the first workflow state. It can't be finished and it must be possible to change workflow state to the next state, so the first transition is enabled. """ mm_seq = IMetroMap(self.case).metromap_sequence initial_state_id = mm_seq.keys()[0] self.assertTrue(mm_seq[initial_state_id]["enabled"]) self.assertFalse(mm_seq[initial_state_id]["finished"])
def test_metromap_second_state(self): """After carrying out the first workflow transition, the first state is finished. If the workflow allows for it, the first transition could still be enabled. The second transition should be enabled. """ mm_seq = IMetroMap(self.case).metromap_sequence first_state_id = mm_seq.keys()[0] first_transition = mm_seq[first_state_id]["transition_id"] api.content.transition(self.case, first_transition) mm_seq = IMetroMap(self.case).metromap_sequence self.assertTrue(mm_seq[first_state_id]["finished"]) second_state_id = mm_seq.keys()[1] self.assertTrue(mm_seq[second_state_id]["enabled"]) self.assertFalse(mm_seq[second_state_id]["finished"])
def transition_icons(self): context = self.context workflow = IMetroMap(context)._metromap_workflow if not workflow: return {} if 'transition_icons' in workflow.variables: return workflow.getInfoFor(context, 'transition_icons', {}) else: return { 'assign': 'icon-right-hand', 'finalise': 'icon-pin', 'request': 'icon-right-circle', 'submit': 'icon-right-circle', 'decide': 'icon-hammer', 'close': 'icon-cancel-circle', 'archive': 'icon-archive', }
def metromap_sequence(self): return IMetroMap(self.context).metromap_sequence