mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-20 11:48:16 +00:00
Getting some thoughts down for the extension property error. This might force us to use regexes for the error service.
Committing so I can work on another branch.
This commit is contained in:
parent
4fc2929356
commit
f937ac3ce9
@ -1,7 +1,11 @@
|
||||
import re
|
||||
|
||||
generic_message = """Workflow validation failed. For more information about the error, see below."""
|
||||
|
||||
known_errors = {'Error is Non-default exclusive outgoing sequence flow without condition':
|
||||
{'message': 'Missing condition', 'hint': 'Add a Condition Type to your gateway path.'}}
|
||||
{'message': 'Missing condition', 'hint': 'Add a Condition Type to your gateway path.'},
|
||||
'^Could not set task title on task (\w+) with \'(.*)\' property because \\1: Error evaluating expression \'(.*)\', "\'Box\' object has no attribute \'\\2\'"$':
|
||||
{'hint': 'You are overriding the title for task xxx, using the display_name extension, and it is causing an error. Look under the extensions tab for the task, and check the value you are setting for the display_name'}}
|
||||
|
||||
|
||||
class ValidationErrorService(object):
|
||||
|
59
tests/data/extension_error/extension_error.bpmn
Normal file
59
tests/data/extension_error/extension_error.bpmn
Normal file
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0sy8lq0" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.5.0">
|
||||
<bpmn:process id="Process_0t9vyh7" isExecutable="true">
|
||||
<bpmn:startEvent id="StartEvent_1">
|
||||
<bpmn:outgoing>SequenceFlow_18e2t7v</bpmn:outgoing>
|
||||
</bpmn:startEvent>
|
||||
<bpmn:sequenceFlow id="SequenceFlow_18e2t7v" sourceRef="StartEvent_1" targetRef="Task_00itqmc" />
|
||||
<bpmn:scriptTask id="Task_00itqmc" name="Set Info Data">
|
||||
<bpmn:incoming>SequenceFlow_18e2t7v</bpmn:incoming>
|
||||
<bpmn:outgoing>SequenceFlow_0h3udgt</bpmn:outgoing>
|
||||
<bpmn:script>info = {'name': 'Charlie', 'title': 'Dog Catcher'}</bpmn:script>
|
||||
</bpmn:scriptTask>
|
||||
<bpmn:sequenceFlow id="SequenceFlow_0h3udgt" sourceRef="Task_00itqmc" targetRef="Task_0xbnd5d" />
|
||||
<bpmn:userTask id="Task_0xbnd5d" name="Get Info Data" camunda:formKey="DataForm">
|
||||
<bpmn:extensionElements>
|
||||
<camunda:properties>
|
||||
<camunda:property name="display_name" value="info.display_name" />
|
||||
</camunda:properties>
|
||||
<camunda:formData>
|
||||
<camunda:formField id="name" type="string" defaultValue="info.name" />
|
||||
</camunda:formData>
|
||||
</bpmn:extensionElements>
|
||||
<bpmn:incoming>SequenceFlow_0h3udgt</bpmn:incoming>
|
||||
<bpmn:outgoing>SequenceFlow_15wmilg</bpmn:outgoing>
|
||||
</bpmn:userTask>
|
||||
<bpmn:endEvent id="EndEvent_0bpvc63">
|
||||
<bpmn:incoming>SequenceFlow_15wmilg</bpmn:incoming>
|
||||
</bpmn:endEvent>
|
||||
<bpmn:sequenceFlow id="SequenceFlow_15wmilg" sourceRef="Task_0xbnd5d" targetRef="EndEvent_0bpvc63" />
|
||||
</bpmn:process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_0t9vyh7">
|
||||
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
|
||||
<dc:Bounds x="179" y="99" width="36" height="36" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge id="SequenceFlow_18e2t7v_di" bpmnElement="SequenceFlow_18e2t7v">
|
||||
<di:waypoint x="215" y="117" />
|
||||
<di:waypoint x="270" y="117" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNShape id="ScriptTask_0zx7n57_di" bpmnElement="Task_00itqmc">
|
||||
<dc:Bounds x="270" y="77" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge id="SequenceFlow_0h3udgt_di" bpmnElement="SequenceFlow_0h3udgt">
|
||||
<di:waypoint x="370" y="117" />
|
||||
<di:waypoint x="430" y="117" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNShape id="UserTask_1knnfxa_di" bpmnElement="Task_0xbnd5d">
|
||||
<dc:Bounds x="430" y="77" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="EndEvent_0bpvc63_di" bpmnElement="EndEvent_0bpvc63">
|
||||
<dc:Bounds x="592" y="99" width="36" height="36" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge id="SequenceFlow_15wmilg_di" bpmnElement="SequenceFlow_15wmilg">
|
||||
<di:waypoint x="530" y="117" />
|
||||
<di:waypoint x="592" y="117" />
|
||||
</bpmndi:BPMNEdge>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</bpmn:definitions>
|
@ -6,15 +6,19 @@ import json
|
||||
class TestCustomerError(BaseTest):
|
||||
|
||||
def test_customer_error(self):
|
||||
# workflow = self.create_workflow('failing_workflow')
|
||||
# workflow_api = self.get_workflow_api(workflow)
|
||||
# first_task = workflow_api.next_task
|
||||
|
||||
self.load_example_data()
|
||||
spec_model = self.load_test_spec('failing_gateway_workflow')
|
||||
# final_data = WorkflowService.test_spec(spec_model.id)
|
||||
#
|
||||
# spec_model = self.load_test_spec('failing_gateway_workflow')
|
||||
|
||||
rv = self.app.get('/v1.0/workflow-specification/%s/validate' % spec_model.id, headers=self.logged_in_headers())
|
||||
# json_data = json.loads(rv.get_data(as_text=True))
|
||||
#
|
||||
print('test_customer_error: ')
|
||||
self.assertIn('hint', rv.json[0])
|
||||
json_data = json.loads(rv.get_data(as_text=True))
|
||||
self.assertEqual('Add a Condition Type to your gateway path.', json_data[0]['hint'])
|
||||
|
||||
def test_extension_error(self):
|
||||
self.load_example_data()
|
||||
spec_model = self.load_test_spec('extension_error')
|
||||
|
||||
rv = self.app.get('/v1.0/workflow-specification/%s/validate' % spec_model.id, headers=self.logged_in_headers())
|
||||
self.assertIn('hint', rv.json[0])
|
||||
json_data = json.loads(rv.get_data(as_text=True))
|
||||
|
Loading…
x
Reference in New Issue
Block a user