Test and BPMN files for testing email script

This commit is contained in:
Sartography 2020-12-06 10:22:32 -05:00
parent aca1fb366b
commit 750a202e99
2 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,71 @@
<?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_bd39673" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.0.0-dev">
<bpmn:process id="Process_fe6205f" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_0scd96e</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_0scd96e" sourceRef="StartEvent_1" targetRef="Activity_1nk2mfb" />
<bpmn:userTask id="Activity_1nk2mfb" name="Email Form" camunda:formKey="email_form">
<bpmn:extensionElements>
<camunda:formData>
<camunda:formField id="email_address" label="Enter Email" type="string" defaultValue="dan@sartography.com">
<camunda:validation>
<camunda:constraint name="required" config="true" />
</camunda:validation>
</camunda:formField>
</camunda:formData>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0scd96e</bpmn:incoming>
<bpmn:outgoing>Flow_0c60gne</bpmn:outgoing>
</bpmn:userTask>
<bpmn:sequenceFlow id="Flow_0c60gne" sourceRef="Activity_1nk2mfb" targetRef="Activity_1u80npy" />
<bpmn:endEvent id="Event_1wh1xsj">
<bpmn:incoming>Flow_19fqvhc</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_19fqvhc" sourceRef="Activity_1u80npy" targetRef="Event_1wh1xsj" />
<bpmn:scriptTask id="Activity_1u80npy" name="Send Email">
<bpmn:documentation>Dear Person,
Thank you for using this email example.
I hope this makes sense.
Yours faithfully,
Dan</bpmn:documentation>
<bpmn:incoming>Flow_0c60gne</bpmn:incoming>
<bpmn:outgoing>Flow_19fqvhc</bpmn:outgoing>
<bpmn:script>email("My Email Subject", email_address)</bpmn:script>
</bpmn:scriptTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_fe6205f">
<bpmndi:BPMNEdge id="Flow_0scd96e_di" bpmnElement="Flow_0scd96e">
<di:waypoint x="215" y="177" />
<di:waypoint x="270" y="177" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0c60gne_di" bpmnElement="Flow_0c60gne">
<di:waypoint x="370" y="177" />
<di:waypoint x="430" y="177" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_19fqvhc_di" bpmnElement="Flow_19fqvhc">
<di:waypoint x="530" y="177" />
<di:waypoint x="592" 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="Activity_0wqsfcj_di" bpmnElement="Activity_1nk2mfb">
<dc:Bounds x="270" y="137" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1wh1xsj_di" bpmnElement="Event_1wh1xsj">
<dc:Bounds x="592" y="159" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1ajacra_di" bpmnElement="Activity_1u80npy">
<dc:Bounds x="430" y="137" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

View File

@ -0,0 +1,20 @@
from tests.base_test import BaseTest
class TestEmailScript(BaseTest):
def test_email_script(self):
workflow = self.create_workflow('email_script')
# Start the workflow.
first_task = self.get_workflow_api(workflow).next_task
# self.assertEqual('Activity_GetData', first_task.name)
workflow = self.get_workflow_api(workflow)
# self.complete_form(workflow, first_task, {'email_address': 'mike@sartography.com'})
# self.complete_form(workflow, first_task, {'email_address': 'kcm4zc'}, user_uid='kcm4zc')
result = self.complete_form(workflow, first_task, {'email_address': "'kcm4zc'"})
print(result)
task = self.get_workflow_api(workflow).next_task
self.assertEqual(task.name, 'string')
# self.assertEqual('Activity_HowMany', workflow.next_task.name)