def test_reset_action_instance(self): pipeline_instance = self._build_pipeline_instance(['1:1', '2:1-2,1'], True) workflow_engine = InstanceWorkflowEngine(self._get_mocked_dal(), pipeline_instance) action_instance = workflow_engine.get_action_instance_by_id(3) workflow_engine.reset_action(action_instance) self.assertEquals(None, pipeline_instance.end_date) self.assertEquals(None, pipeline_instance.stage_instances[1].end_date) self.assertEquals( None, pipeline_instance.stage_instances[1].workflow_instances[1]. end_date) self.assertEquals(None, action_instance.end_date) self.assertEquals(StatusConstants.READY, action_instance.status_id)
def reset_action_instance(self, _id, complete_reset=False, check_status=False): # pylint: disable=unused-argument for session in get_db_session(): action_instance = session.query(ActionInstance).get(_id) if check_status and action_instance.status_id != StatusConstants.INPROGRESS: return False instance_workflow_engine = InstanceWorkflowEngine( self.status_dal, action_instance.pipeline_instance) instance_workflow_engine.reset_action(action_instance) if self.qa_module is not None: self.qa_module.reset_results(action_instance.id, session) session.commit() return True