def test_create_action_instance_with_no_slicing(self): workflow_engine = InstanceWorkflowEngine(Mock(), Mock()) workflow_instance = WorkflowInstance(id=1) workflow = Workflow(actions=[ Action(slices=0, id=1, cmd="test1"), Action(slices=0, id=2, cmd="test2") ]) workflow_engine._create_action_instances(Mock(id=1), workflow_instance, workflow) eq_(2, len(workflow_instance.action_instances)) eq_('test1', workflow_instance.action_instances[0].cmd) eq_(StatusConstants.READY, workflow_instance.action_instances[0].status_id) eq_('test2', workflow_instance.action_instances[1].cmd) eq_(StatusConstants.NEW, workflow_instance.action_instances[1].status_id)
def test_create_action_instance_with_slicing_before(self): workflow_engine = InstanceWorkflowEngine(Mock(), Mock()) workflow_instance = WorkflowInstance(id=1) workflow = Workflow(actions=[ Action(slices=4, id=1, cmd="test1"), Action(slices=0, id=2, cmd="test2") ]) workflow_engine._create_action_instances(Mock(id=1), workflow_instance, workflow) eq_(5, len(workflow_instance.action_instances)) for i in range(0, 4): eq_('test1', workflow_instance.action_instances[i].cmd) eq_(StatusConstants.READY, workflow_instance.action_instances[i].status_id) eq_('test2', workflow_instance.action_instances[4].cmd) eq_(StatusConstants.NEW, workflow_instance.action_instances[4].status_id)