spiff-arena/tests/SpiffWorkflow/bpmn/ParallelOrderTest.py
Jon Herron 0892db6fa7 Squashed 'SpiffWorkflow/' content from commit 63db3e4
git-subtree-dir: SpiffWorkflow
git-subtree-split: 63db3e45947ec66b8d0efc2c74064004f8ff482c
2022-10-12 10:19:53 -04:00

39 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
import sys
import os
import unittest
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..'))
from SpiffWorkflow.bpmn.workflow import BpmnWorkflow
from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase
__author__ = 'matth'
class MultiInstanceTest(BpmnWorkflowTestCase):
"""The example bpmn diagram has a 4 parallel workflows, this
verifies that the parallel tasks have a natural order that follows
the visual layout of the diagram, rather than just the order in which
they were created. """
def setUp(self):
spec, subprocesses = self.load_workflow_spec('ParallelOrder.bpmn','ParallelOrder')
self.workflow = BpmnWorkflow(spec, subprocesses)
def testRunThroughHappy(self):
self.workflow.do_engine_steps()
self.assertFalse(self.workflow.is_completed())
self.assertEquals(4, len(self.workflow.get_ready_user_tasks()))
tasks = self.workflow.get_ready_user_tasks()
self.assertEquals("Task 1", tasks[0].get_description())
self.assertEquals("Task 2", tasks[1].get_description())
self.assertEquals("Task 3", tasks[2].get_description())
self.assertEquals("Task 4", tasks[3].get_description())
def suite():
return unittest.TestLoader().loadTestsFromTestCase(MultiInstanceTest)
if __name__ == '__main__':
unittest.TextTestRunner(verbosity=2).run(suite())