mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-01-09 17:55:48 +00:00
0892db6fa7
git-subtree-dir: SpiffWorkflow git-subtree-split: 63db3e45947ec66b8d0efc2c74064004f8ff482c
47 lines
1.5 KiB
Python
47 lines
1.5 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 single task with a loop cardinality of 5.
|
|
It should repeat 5 times before termination."""
|
|
|
|
def setUp(self):
|
|
spec, subprocesses = self.load_workflow_spec('bpmnMultiUserTask.bpmn','MultiInstance')
|
|
self.workflow = BpmnWorkflow(spec, subprocesses)
|
|
|
|
|
|
def testRunThroughHappy(self):
|
|
|
|
for i in range(5):
|
|
self.workflow.do_engine_steps()
|
|
self.assertFalse(self.workflow.is_completed())
|
|
self.do_next_exclusive_step('Activity_Loop')
|
|
|
|
self.workflow.do_engine_steps()
|
|
self.assertTrue(self.workflow.is_completed())
|
|
|
|
def testSaveRestore(self):
|
|
|
|
for i in range(5):
|
|
self.save_restore()
|
|
self.workflow.do_engine_steps()
|
|
self.assertFalse(self.workflow.is_completed())
|
|
self.do_next_exclusive_step('Activity_Loop')
|
|
|
|
self.workflow.do_engine_steps()
|
|
self.assertTrue(self.workflow.is_completed())
|
|
|
|
def suite():
|
|
return unittest.TestLoader().loadTestsFromTestCase(MultiInstanceTest)
|
|
if __name__ == '__main__':
|
|
unittest.TextTestRunner(verbosity=2).run(suite())
|