mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-22 20:58:28 +00:00
Test for new script
This commit is contained in:
parent
8c66a35f36
commit
6ec7241a7b
84
tests/data/delete_variables/delete_variables.bpmn
Normal file
84
tests/data/delete_variables/delete_variables.bpmn
Normal file
@ -0,0 +1,84 @@
|
||||
<?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:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0vysnuw" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.2.0">
|
||||
<bpmn:process id="Process_1so2rqu" name="Delete Variables from Task Data" isExecutable="true">
|
||||
<bpmn:startEvent id="StartEvent_1">
|
||||
<bpmn:outgoing>Flow_0zdl9n2</bpmn:outgoing>
|
||||
</bpmn:startEvent>
|
||||
<bpmn:sequenceFlow id="Flow_0zdl9n2" sourceRef="StartEvent_1" targetRef="Activity_1ufzsi0" />
|
||||
<bpmn:sequenceFlow id="Flow_14niiph" sourceRef="Activity_1ufzsi0" targetRef="Activity_16c0ane" />
|
||||
<bpmn:sequenceFlow id="Flow_1wjlzq0" sourceRef="Activity_0nuz6z0" targetRef="Activity_0gtt0h2" />
|
||||
<bpmn:endEvent id="Event_1dxgxez">
|
||||
<bpmn:incoming>Flow_0aftk6v</bpmn:incoming>
|
||||
</bpmn:endEvent>
|
||||
<bpmn:sequenceFlow id="Flow_0aftk6v" sourceRef="Activity_0gtt0h2" targetRef="Event_1dxgxez" />
|
||||
<bpmn:scriptTask id="Activity_1ufzsi0" name="Create Variables">
|
||||
<bpmn:incoming>Flow_0zdl9n2</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_14niiph</bpmn:outgoing>
|
||||
<bpmn:script>a = 1
|
||||
b = 2
|
||||
c = 'a string'
|
||||
d = a + b
|
||||
e = datetime.datetime.now()</bpmn:script>
|
||||
</bpmn:scriptTask>
|
||||
<bpmn:scriptTask id="Activity_0nuz6z0" name="Delete Variables">
|
||||
<bpmn:incoming>Flow_0ke44z0</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_1wjlzq0</bpmn:outgoing>
|
||||
<bpmn:script>delete_variables('a', 'b', 'c', 'd', 'e')</bpmn:script>
|
||||
</bpmn:scriptTask>
|
||||
<bpmn:manualTask id="Activity_0gtt0h2" name="Print Task Data">
|
||||
<bpmn:documentation>## Task Data
|
||||
{{ task_data }}</bpmn:documentation>
|
||||
<bpmn:incoming>Flow_1wjlzq0</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_0aftk6v</bpmn:outgoing>
|
||||
</bpmn:manualTask>
|
||||
<bpmn:sequenceFlow id="Flow_0ke44z0" sourceRef="Activity_16c0ane" targetRef="Activity_0nuz6z0" />
|
||||
<bpmn:manualTask id="Activity_16c0ane" name="Print Task Data">
|
||||
<bpmn:documentation>## Task Data
|
||||
{{ task_data }}</bpmn:documentation>
|
||||
<bpmn:incoming>Flow_14niiph</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_0ke44z0</bpmn:outgoing>
|
||||
</bpmn:manualTask>
|
||||
</bpmn:process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1so2rqu">
|
||||
<bpmndi:BPMNEdge id="Flow_0zdl9n2_di" bpmnElement="Flow_0zdl9n2">
|
||||
<di:waypoint x="215" y="117" />
|
||||
<di:waypoint x="270" y="117" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="Flow_14niiph_di" bpmnElement="Flow_14niiph">
|
||||
<di:waypoint x="370" y="117" />
|
||||
<di:waypoint x="430" y="117" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="Flow_0ke44z0_di" bpmnElement="Flow_0ke44z0">
|
||||
<di:waypoint x="530" y="117" />
|
||||
<di:waypoint x="588" y="117" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="Flow_1wjlzq0_di" bpmnElement="Flow_1wjlzq0">
|
||||
<di:waypoint x="688" y="117" />
|
||||
<di:waypoint x="748" y="117" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="Flow_0aftk6v_di" bpmnElement="Flow_0aftk6v">
|
||||
<di:waypoint x="848" y="117" />
|
||||
<di:waypoint x="910" y="117" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
|
||||
<dc:Bounds x="179" y="99" width="36" height="36" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Activity_0ukmng8_di" bpmnElement="Activity_1ufzsi0">
|
||||
<dc:Bounds x="270" y="77" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Event_1dxgxez_di" bpmnElement="Event_1dxgxez">
|
||||
<dc:Bounds x="910" y="99" width="36" height="36" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Activity_0ykd81y_di" bpmnElement="Activity_0nuz6z0">
|
||||
<dc:Bounds x="588" y="77" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Activity_1x2rbnn_di" bpmnElement="Activity_0gtt0h2">
|
||||
<dc:Bounds x="748" y="77" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Activity_0baxotx_di" bpmnElement="Activity_16c0ane">
|
||||
<dc:Bounds x="430" y="77" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</bpmn:definitions>
|
18
tests/workflow/test_workflow_delete_variables.py
Normal file
18
tests/workflow/test_workflow_delete_variables.py
Normal file
@ -0,0 +1,18 @@
|
||||
from tests.base_test import BaseTest
|
||||
|
||||
|
||||
class TestDeleteVariables(BaseTest):
|
||||
|
||||
def test_delete_variables(self):
|
||||
"""This workflow creates variables 'a', 'b', 'c', 'd', and 'e',
|
||||
then deletes them with the delete_variables script.
|
||||
We assert that they are no longer in task.data"""
|
||||
workflow = self.create_workflow('delete_variables')
|
||||
workflow_api = self.get_workflow_api(workflow)
|
||||
task = workflow_api.next_task
|
||||
for item in ('a', 'b', 'c', 'd', 'e'):
|
||||
self.assertIn(item, task.data)
|
||||
workflow_api = self.complete_form(workflow, task, {})
|
||||
task = workflow_api.next_task
|
||||
for item in ('a', 'b', 'c', 'd', 'e'):
|
||||
self.assertNotIn(item, task.data)
|
Loading…
x
Reference in New Issue
Block a user