mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-01-17 21:51:43 +00:00
0892db6fa7
git-subtree-dir: SpiffWorkflow git-subtree-split: 63db3e45947ec66b8d0efc2c74064004f8ff482c
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
|
|
import unittest
|
|
|
|
from SpiffWorkflow.bpmn.workflow import BpmnWorkflow
|
|
|
|
from .BaseTestCase import BaseTestCase
|
|
|
|
class DMNDictTest(BaseTestCase):
|
|
|
|
def setUp(self):
|
|
self.spec, subprocesses = self.load_workflow_spec('dmndict.bpmn', 'start', 'dmndict.dmn')
|
|
self.workflow = BpmnWorkflow(self.spec)
|
|
self.expectedResult = {'inputvar': 1, 'pi': {'test': {'me': 'yup it worked'}, 'test2': {'other': 'yes'}}}
|
|
|
|
def testDmnHappy(self):
|
|
self.workflow = BpmnWorkflow(self.spec)
|
|
self.workflow.do_engine_steps()
|
|
x = self.workflow.get_ready_user_tasks()
|
|
self.workflow.complete_task_from_id(x[0].id)
|
|
self.workflow.do_engine_steps()
|
|
self.assertDictEqual(self.workflow.last_task.data, self.expectedResult)
|
|
|
|
def testDmnSaveRestore(self):
|
|
self.workflow = BpmnWorkflow(self.spec)
|
|
self.workflow.do_engine_steps()
|
|
self.save_restore()
|
|
x = self.workflow.get_ready_user_tasks()
|
|
self.workflow.complete_task_from_id(x[0].id)
|
|
self.workflow.do_engine_steps()
|
|
self.save_restore()
|
|
self.assertDictEqual(self.workflow.last_task.data, self.expectedResult)
|
|
|
|
|
|
|
|
|
|
def suite():
|
|
return unittest.TestLoader().loadTestsFromTestCase(DMNDictTest)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.TextTestRunner(verbosity=2).run(suite())
|