mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-01-09 17:55:48 +00:00
1bed0fb3ee
cd4da465 Merge pull request #264 from sartography/bugfix/dmn-equality-with-boolean 414a59eb disambiguate DMN expressions eea53c91 Merge pull request #263 from sartography/feature/cleanup-task-completion d248d5b1 execute postscript before other complete hook tasks c09f1a90 streamline predict & remove some duplicated calls to it 64c21791 remove duplicate calls to update 4ca1076d move task update to _on_complete to ensure data is copied consistently after task related activities are done d037a7eb small changes for readability 025bc30f Quick patch -- is_executable needs to be accurate immediately. 14d3d8c3 Merge pull request #262 from sartography/feature/parser_info_features 849c223e We are jumping through a lot of complex xml parsing in SpiffWorkflow-Backend because we need to know some basic information about a BPMN process at the moment it is saved. Rather than do that work in the backend, it seems better to have SpiffWorkflow handle parsing the xml and providing a bit of metadata, including: git-subtree-dir: SpiffWorkflow git-subtree-split: cd4da465e125ca1ae1b57d227bfa324d9d4c507c
69 lines
2.6 KiB
Python
69 lines
2.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
import unittest
|
|
from SpiffWorkflow.bpmn.workflow import BpmnWorkflow
|
|
from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase
|
|
|
|
__author__ = 'kellym'
|
|
|
|
|
|
class SwimLaneTest(BpmnWorkflowTestCase):
|
|
"""
|
|
Test sample bpmn document to make sure the nav list
|
|
contains the correct swimlane in the 'lane' component
|
|
and make sure that our waiting tasks accept a lane parameter
|
|
and that it picks up the correct tasks.
|
|
"""
|
|
|
|
def setUp(self):
|
|
spec, subprocesses = self.load_workflow_spec('lanes.bpmn','lanes')
|
|
self.workflow = BpmnWorkflow(spec, subprocesses)
|
|
|
|
def testBpmnParserKnowsLanesExist(self):
|
|
parser = self.get_parser('lanes.bpmn')
|
|
self.assertTrue(parser.get_process_parser('lanes').has_lanes())
|
|
parser = self.get_parser('random_fact.bpmn')
|
|
self.assertFalse(parser.get_process_parser('random_fact').has_lanes())
|
|
|
|
def testRunThroughHappy(self):
|
|
|
|
self.workflow.do_engine_steps()
|
|
|
|
atasks = self.workflow.get_ready_user_tasks(lane="A")
|
|
btasks = self.workflow.get_ready_user_tasks(lane="B")
|
|
self.assertEqual(1, len(atasks))
|
|
self.assertEqual(0, len(btasks))
|
|
task = atasks[0]
|
|
self.assertEqual('Activity_A1', task.task_spec.name)
|
|
self.workflow.complete_task_from_id(task.id)
|
|
self.workflow.do_engine_steps()
|
|
atasks = self.workflow.get_ready_user_tasks(lane="A")
|
|
btasks = self.workflow.get_ready_user_tasks(lane="B")
|
|
self.assertEqual(0, len(atasks))
|
|
self.assertEqual(1, len(btasks))
|
|
|
|
# Complete the gateway and the two tasks in B Lane
|
|
btasks[0].data = {'NeedClarification': False}
|
|
self.workflow.complete_task_from_id(btasks[0].id)
|
|
self.workflow.do_engine_steps()
|
|
btasks = self.workflow.get_ready_user_tasks(lane="B")
|
|
self.workflow.complete_task_from_id(btasks[0].id)
|
|
self.workflow.do_engine_steps()
|
|
|
|
# Assert we are in lane C
|
|
tasks = self.workflow.get_ready_user_tasks()
|
|
self.assertEqual(1, len(tasks))
|
|
self.assertEqual(tasks[0].task_spec.lane, "C")
|
|
|
|
# Step into the sub-process, assure that is also in lane C
|
|
self.workflow.complete_task_from_id(tasks[0].id)
|
|
self.workflow.do_engine_steps()
|
|
tasks = self.workflow.get_ready_user_tasks()
|
|
self.assertEqual("SubProcessTask", tasks[0].task_spec.description)
|
|
self.assertEqual(tasks[0].task_spec.lane, "C")
|
|
|
|
def suite():
|
|
return unittest.TestLoader().loadTestsFromTestCase(SwimLaneTest)
|
|
if __name__ == '__main__':
|
|
unittest.TextTestRunner(verbosity=2).run(suite())
|