spiff-arena/tests/SpiffWorkflow/camunda/UserTaskParserTest.py
jasquat 69e814758e Squashed 'SpiffWorkflow/' changes from 12f81480a..d27519a36
d27519a36 Merge pull request #259 from sartography/bugfix/spiff-postscript-execution
21aa8a12c update execution order for postscripts
d83fd3d81 Merge pull request #256 from sartography/feature/xml-validation
8303aaab5 uping the sleep time in a test slightly to see if we can get this test to pass consistently in CI.
1d251d55d determine whether to validate by passing in a validator instead of a parameter
2d3daad2d add spiff schema
f8c65dc60 Minor changes to BPMN diagrams to assure all tests are run against valid BPMN Diagrams. Changes required:
9e06b25bf add DMN validation
1b7cbeba0 set parser to validate by default
53fdbba52 add schemas & validation option
a212d9c5d general cleanup

git-subtree-dir: SpiffWorkflow
git-subtree-split: d27519a3631b9772094e5f24dba2f478b0c47135
2022-10-27 10:50:48 -04:00

50 lines
1.8 KiB
Python

import unittest
from SpiffWorkflow.camunda.parser.task_spec import UserTaskParser
from tests.SpiffWorkflow.camunda.BaseTestCase import BaseTestCase
class UserTaskParserTest(BaseTestCase):
CORRELATE = UserTaskParser
def setUp(self):
self.spec, subprocesses = self.load_workflow_spec('random_fact.bpmn', 'random_fact')
def testGetForm(self):
form = self.spec.task_specs['Task_User_Select_Type'].form
self.assertIsNotNone(form)
def testGetEnumField(self):
form = self.spec.task_specs['Task_User_Select_Type'].form
self.assertEquals("Fact", form.key)
self.assertEquals(1, len(form.fields))
self.assertEquals("type", form.fields[0].id)
self.assertEquals(3, len(form.fields[0].options))
def testGetFieldProperties(self):
form = self.spec.task_specs['Task_User_Select_Type'].form
self.assertEquals(1, len(form.fields[0].properties))
self.assertEquals('description', form.fields[0].properties[0].id)
self.assertEquals('Choose from the list of available types of random facts', form.fields[0].properties[0].value)
def testGetFieldValidation(self):
form = self.spec.task_specs['Task_User_Select_Type'].form
self.assertEquals(1, len(form.fields[0].validation))
self.assertEquals('maxlength', form.fields[0].validation[0].name)
self.assertEquals('25', form.fields[0].validation[0].config)
def testNoFormDoesNotBombOut(self):
self.load_workflow_spec('no_form.bpmn', 'no_form')
self.assertTrue(True) # You can load a user task that has no form and you can still get here.
def testCreateTask(self):
pass
def suite():
return unittest.TestLoader().loadTestsFromTestCase(UserTaskParserTest)
if __name__ == '__main__':
unittest.TextTestRunner(verbosity=2).run(suite())