test for this ticket

This commit is contained in:
alicia pritchett 2021-12-03 12:23:57 -05:00
parent 7524e97c9a
commit 22320efad4
2 changed files with 81 additions and 1 deletions

View File

@ -0,0 +1,58 @@
<?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_14c1a61" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.0.0-dev">
<bpmn:process id="Process_14c1a61" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_11cx59a</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_11cx59a" sourceRef="StartEvent_1" targetRef="Activity_0q620ux" />
<bpmn:sequenceFlow id="Flow_0fv2tx1" sourceRef="Activity_0q620ux" targetRef="Activity_0k0jycd" />
<bpmn:endEvent id="Event_0b87jzl">
<bpmn:incoming>Flow_0ku2w8w</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_0ku2w8w" sourceRef="Activity_0k0jycd" targetRef="Event_0b87jzl" />
<bpmn:manualTask id="Activity_0k0jycd" name="stop before the end">
<bpmn:incoming>Flow_0fv2tx1</bpmn:incoming>
<bpmn:outgoing>Flow_0ku2w8w</bpmn:outgoing>
</bpmn:manualTask>
<bpmn:userTask id="Activity_0q620ux" name="test task exentsions" camunda:formKey="formkey">
<bpmn:extensionElements>
<camunda:formData>
<camunda:formField id="field1" label="should clear the data on return" type="string" />
</camunda:formData>
<camunda:properties>
<camunda:property name="clear_data" value="True" />
</camunda:properties>
</bpmn:extensionElements>
<bpmn:incoming>Flow_11cx59a</bpmn:incoming>
<bpmn:outgoing>Flow_0fv2tx1</bpmn:outgoing>
</bpmn:userTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_14c1a61">
<bpmndi:BPMNEdge id="Flow_0ku2w8w_di" bpmnElement="Flow_0ku2w8w">
<di:waypoint x="530" y="177" />
<di:waypoint x="592" y="177" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0fv2tx1_di" bpmnElement="Flow_0fv2tx1">
<di:waypoint x="370" y="177" />
<di:waypoint x="430" y="177" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_11cx59a_di" bpmnElement="Flow_11cx59a">
<di:waypoint x="215" y="177" />
<di:waypoint x="270" y="177" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="159" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0b87jzl_di" bpmnElement="Event_0b87jzl">
<dc:Bounds x="592" y="159" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0hnr103_di" bpmnElement="Activity_0k0jycd">
<dc:Bounds x="430" y="137" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_102qet9_di" bpmnElement="Activity_0q620ux">
<dc:Bounds x="270" y="137" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

View File

@ -100,6 +100,28 @@ class TestWorkflowService(BaseTest):
workflow_spec_model = self.load_test_spec("form_expressions")
WorkflowService.test_spec(workflow_spec_model.id)
def test_task_properties(self):
workflow = self.create_workflow("form_extentsions")
workflow_api = self.get_workflow_api(workflow)
# Start with task 1
first_task = workflow_api.next_task
self.assertIn('clear_data', first_task.properties)
self.complete_form(workflow, first_task, {'field1': 'some data'})
workflow_api = self.get_workflow_api(workflow)
# Move to task 2
second_task = workflow_api.next_task
self.assertIn('field1', workflow_api.next_task.data )
result = self.complete_form(workflow, second_task, {})
workflow_api = self.restart_workflow_api(result)
# Move back to task 1
first_task = workflow_api.next_task
self.assertNotIn("field1", workflow_api.next_task.data)
self.assertNotIn("field1", first_task.data)
def test_set_value(self):
destiation = {}
path = "a.b.c"
@ -117,10 +139,10 @@ class TestWorkflowService(BaseTest):
self.assertEqual("garbage", result2)
def test_get_primary_workflow(self):
workflow = self.create_workflow('hello_world')
workflow_spec_id = workflow.workflow_spec.id
primary_workflow = WorkflowService.get_primary_workflow(workflow_spec_id)
self.assertIsInstance(primary_workflow, FileModel)
self.assertEqual(workflow_spec_id, primary_workflow.workflow_spec_id)
self.assertEqual('hello_world.bpmn', primary_workflow.name)