mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-01-15 20:14:56 +00:00
0892db6fa7
git-subtree-dir: SpiffWorkflow git-subtree-split: 63db3e45947ec66b8d0efc2c74064004f8ff482c
43 lines
1.5 KiB
Python
43 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import unittest
|
|
from SpiffWorkflow.bpmn.workflow import BpmnWorkflow
|
|
from SpiffWorkflow.exceptions import WorkflowException
|
|
from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase
|
|
|
|
__author__ = 'kellym'
|
|
|
|
|
|
class AntiLoopTaskTest(BpmnWorkflowTestCase):
|
|
"""The example bpmn is actually a MultiInstance. It should not report that it is a looping task and
|
|
it should fail when we try to terminate the loop"""
|
|
|
|
def setUp(self):
|
|
spec, subprocesses = self.load_workflow_spec('bpmnAntiLoopTask.bpmn','LoopTaskTest')
|
|
self.workflow = BpmnWorkflow(spec, subprocesses)
|
|
|
|
def testRunThroughHappy(self):
|
|
|
|
self.workflow.do_engine_steps()
|
|
ready_tasks = self.workflow.get_ready_user_tasks()
|
|
self.assertTrue(len(ready_tasks) ==1)
|
|
self.assertFalse(ready_tasks[0].task_spec.is_loop_task())
|
|
try:
|
|
ready_tasks[0].terminate_loop()
|
|
self.fail("Terminate Loop should throw and error when called on a non-loop MultiInstance")
|
|
except WorkflowException as ex:
|
|
self.assertTrue(
|
|
'The method terminate_loop should only be called in the case of a BPMN Loop Task' in (
|
|
'%r' % ex),
|
|
'\'The method terminate_loop should only be called in the case of a BPMN Loop Task\' should be a substring of error message: \'%r\'' % ex)
|
|
|
|
|
|
|
|
|
|
def suite():
|
|
return unittest.TestLoader().loadTestsFromTestCase(AntiLoopTaskTest)
|
|
if __name__ == '__main__':
|
|
unittest.TextTestRunner(verbosity=2).run(suite())
|