def test_activate_next_action_all_complete_with_inprogress(self): workflow_engine = InstanceWorkflowEngine(Mock(), Mock()) action_instances = [ ActionInstance(status_id=StatusConstants.SUCCESS, order=0), ActionInstance(status_id=StatusConstants.INPROGRESS, order=1), ActionInstance(status_id=StatusConstants.NEW, order=2) ] workflow_engine._activate_next_action_all_complete(action_instances) eq_(StatusConstants.INPROGRESS, action_instances[1].status_id) eq_(StatusConstants.NEW, action_instances[2].status_id)
def test_activate_next_action_all_complete_with_unknown(self): workflow_engine = InstanceWorkflowEngine(Mock(), Mock()) workflow_engine.status_cache[StatusConstants.UNKNOWN] = Status( type=StatusTypes.WARNING) action_instances = [ ActionInstance(status_id=StatusConstants.SUCCESS, order=0), ActionInstance(status_id=StatusConstants.UNKNOWN, order=1), ActionInstance(status_id=StatusConstants.NEW, order=2) ] workflow_engine._activate_next_action_all_complete(action_instances) eq_(StatusConstants.UNKNOWN, action_instances[1].status_id) eq_(StatusConstants.NEW, action_instances[2].status_id)
def test_activate_next_action_all_complete_with_canceled(self): workflow_engine = InstanceWorkflowEngine(Mock(), Mock()) workflow_engine.status_cache[StatusConstants.CANCELED] = Status( type=StatusTypes.CANCELED) action_instances = [ ActionInstance(status_id=StatusConstants.SUCCESS, order=0), ActionInstance(status_id=StatusConstants.CANCELED, order=1), ActionInstance(status_id=StatusConstants.NEW, order=2) ] workflow_engine._activate_next_action_all_complete(action_instances) eq_(StatusConstants.CANCELED, action_instances[1].status_id) eq_(StatusConstants.NEW, action_instances[2].status_id)
def test_activate_next_action_all_complete_with_same_order_multiple_new( self): workflow_engine = InstanceWorkflowEngine(Mock(), Mock()) action_instances = [ ActionInstance(status_id=StatusConstants.SUCCESS, order=0), ActionInstance(status_id=StatusConstants.NEW, order=1), ActionInstance(status_id=StatusConstants.NEW, order=1), ActionInstance(status_id=StatusConstants.NEW, order=2) ] return_value = workflow_engine._activate_next_action_all_complete( action_instances) eq_(StatusConstants.READY, action_instances[1].status_id) eq_(StatusConstants.READY, action_instances[2].status_id) eq_(StatusConstants.NEW, action_instances[3].status_id) ok_(not return_value)
def test_activate_next_action_all_complete_simple(self): workflow_engine = InstanceWorkflowEngine(Mock(), Mock()) action_instances = [ActionInstance(status_id=StatusConstants.NEW)] workflow_engine._activate_next_action_all_complete(action_instances) eq_(StatusConstants.READY, action_instances[0].status_id)