spiff-arena/tests/SpiffWorkflow/camunda/InvalidBusinessRuleTaskParserTest.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

36 lines
1.2 KiB
Python

import os
import unittest
from SpiffWorkflow.bpmn.exceptions import WorkflowTaskExecException
from SpiffWorkflow.task import TaskState
from SpiffWorkflow.bpmn.workflow import BpmnWorkflow
from .BaseTestCase import BaseTestCase
class BusinessRuleTaskParserTest(BaseTestCase):
def setUp(self):
self.spec, subproceses = self.load_workflow_spec(
'invalid/InvalidDecision.bpmn', 'Process_1', 'invalid_decision.dmn')
self.workflow = BpmnWorkflow(self.spec)
def testDmnRaisesTaskErrors(self):
self.workflow = BpmnWorkflow(self.spec)
self.workflow.get_tasks(TaskState.READY)[0].set_data(x=3)
try:
self.workflow.do_engine_steps()
self.assertTrue(False, "An error should have been raised.")
except WorkflowTaskExecException as we:
self.assertTrue(True, "An error was raised..")
self.assertEquals("InvalidDecisionTaskId", we.sender.name)
self.maxDiff = 1000
self.assertEquals("Error evaluating expression spam= 1", str(we))
def suite():
return unittest.TestLoader().loadTestsFromTestCase(BusinessRuleTaskParserTest)
if __name__ == '__main__':
unittest.TextTestRunner(verbosity=2).run(suite())