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

30 lines
1.1 KiB
Python

import unittest
import os
from SpiffWorkflow.bpmn.parser.BpmnParser import BpmnParser
class ParserTest(unittest.TestCase):
def testIOSpecification(self):
parser = BpmnParser()
bpmn_file = os.path.join(os.path.dirname(__file__), 'data', 'io_spec.bpmn')
parser.add_bpmn_file(bpmn_file)
spec = parser.get_spec('subprocess')
self.assertEqual(len(spec.data_inputs), 2)
self.assertEqual(len(spec.data_outputs), 2)
def testDataReferences(self):
parser = BpmnParser()
bpmn_file = os.path.join(os.path.dirname(__file__), 'data', 'data_object.bpmn')
parser.add_bpmn_file(bpmn_file)
spec = parser.get_spec("Process")
generate = spec.task_specs['generate_data']
read = spec.task_specs['read_data']
self.assertEqual(len(generate.data_output_associations), 1)
self.assertEqual(generate.data_output_associations[0].name, 'obj_1')
self.assertEqual(len(read.data_input_associations), 1)
self.assertEqual(read.data_input_associations[0].name, 'obj_1')