# -*- coding: utf-8 -*- import unittest from SpiffWorkflow.task import TaskState from SpiffWorkflow.bpmn.workflow import BpmnWorkflow from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase __author__ = 'matth' class ParallelMultipleSplitsTest(BpmnWorkflowTestCase): def setUp(self): spec, subprocesses = self.load_workflow_spec('Test-Workflows/Parallel-Multiple-Splits.bpmn20.xml', 'Parallel Multiple Splits') self.workflow = BpmnWorkflow(spec, subprocesses) self.workflow.do_engine_steps() def testRunThroughAlternating(self): self.assertEqual(2, len(self.workflow.get_tasks(TaskState.READY))) self.do_next_named_step('Do First') self.workflow.do_engine_steps() self.do_next_named_step('SP 1 - Choose', choice='Yes') self.workflow.do_engine_steps() self.do_next_named_step('SP 2 - Choose', choice='Yes') self.workflow.do_engine_steps() self.do_next_named_step('SP 3 - Choose', choice='Yes') self.workflow.do_engine_steps() self.do_next_named_step('SP 1 - Yes Task') self.workflow.do_engine_steps() self.do_next_named_step('SP 2 - Yes Task') self.workflow.do_engine_steps() self.do_next_named_step('SP 3 - Yes Task') self.workflow.do_engine_steps() self.do_next_named_step('Done') self.workflow.do_engine_steps() self.assertEqual( 0, len(self.workflow.get_tasks(TaskState.READY | TaskState.WAITING))) def suite(): return unittest.TestLoader().loadTestsFromTestCase(ParallelMultipleSplitsTest) if __name__ == '__main__': unittest.TextTestRunner(verbosity=2).run(suite())