Better test to make sure file data works with all standard field types.

(Except maybe custom types)
This commit is contained in:
mike cullerton 2021-07-23 11:25:36 -04:00
parent 4c8a86f9bf
commit 612ce6dc35
2 changed files with 50 additions and 15 deletions

View File

@ -1,5 +1,5 @@
<?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_0b469f0" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.0.0-dev">
<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_0b469f0" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.5.0">
<bpmn:process id="Process_4b7fa29" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_1kvuzs1</bpmn:outgoing>
@ -21,6 +21,26 @@
</camunda:validation>
</camunda:formField>
<camunda:formField id="Study_App_Doc" label="IRB-HSR Application" type="file" />
<camunda:formField id="my_test_field" label="Nickname" type="string">
<camunda:properties>
<camunda:property id="file_data" value="Study_App_Doc" />
</camunda:properties>
</camunda:formField>
<camunda:formField id="some_date" label="Date" type="date">
<camunda:properties>
<camunda:property id="file_data" value="Study_App_Doc" />
</camunda:properties>
</camunda:formField>
<camunda:formField id="a_boolean" label="A Boolean" type="boolean">
<camunda:properties>
<camunda:property id="file_data" value="Study_App_Doc" />
</camunda:properties>
</camunda:formField>
<camunda:formField id="the_number" label="The Number" type="long">
<camunda:properties>
<camunda:property id="file_data" value="Study_App_Doc" />
</camunda:properties>
</camunda:formField>
</camunda:formData>
</bpmn:extensionElements>
<bpmn:incoming>Flow_1kvuzs1</bpmn:incoming>
@ -40,28 +60,28 @@
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_4b7fa29">
<bpmndi:BPMNEdge id="Flow_0h5cdg9_di" bpmnElement="Flow_0h5cdg9">
<di:waypoint x="530" y="177" />
<di:waypoint x="592" y="177" />
<di:waypoint x="530" y="117" />
<di:waypoint x="592" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0han7ki_di" bpmnElement="Flow_0han7ki">
<di:waypoint x="370" y="177" />
<di:waypoint x="430" y="177" />
<di:waypoint x="370" y="117" />
<di:waypoint x="430" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1kvuzs1_di" bpmnElement="Flow_1kvuzs1">
<di:waypoint x="215" y="177" />
<di:waypoint x="270" y="177" />
<di:waypoint x="215" y="117" />
<di:waypoint x="270" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="159" width="36" height="36" />
<dc:Bounds x="179" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_11t0hqf_di" bpmnElement="Activity_0gtrm5e">
<dc:Bounds x="270" y="137" width="100" height="80" />
<dc:Bounds x="270" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0fax1lv_di" bpmnElement="Activity_0gpetln">
<dc:Bounds x="430" y="137" width="100" height="80" />
<dc:Bounds x="430" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_124aupd_di" bpmnElement="Event_124aupd">
<dc:Bounds x="592" y="159" width="36" height="36" />
<dc:Bounds x="592" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>

View File

@ -48,9 +48,24 @@ class TestFileDatastore(BaseTest):
# process the form that sets the datastore values
self.complete_form(workflow, task, {'Study_App_Doc': {'id': file_id},
'IRB_HSR_Application_Type': {'label': 'Expedited Application'}})
'IRB_HSR_Application_Type': {'label': 'Expedited Application'},
'my_test_field': 'some string',
'the_number': 8,
'a_boolean': True,
'some_date': '2021-07-23'})
# assert the data_store was set correctly
data_store = db.session.query(DataStoreModel).filter(DataStoreModel.file_id==file_id).first()
self.assertEqual('IRB_HSR_Application_Type', data_store.key)
self.assertEqual('Expedited Application', data_store.value)
data_store_keys = ['IRB_HSR_Application_Type', 'my_test_field', 'the_number', 'a_boolean', 'some_date']
data_store = db.session.query(DataStoreModel).filter(DataStoreModel.file_id==file_id).all()
for item in data_store:
self.assertIn(item.key, data_store_keys)
if item.key == 'IRB_HSR_Application_Type':
self.assertEqual('Expedited Application', item.value)
if item.key == 'my_test_field':
self.assertEqual('some string', item.value)
if item.key == 'the_number':
self.assertEqual('8', item.value)
if item.key == 'a_boolean':
self.assertEqual('true', item.value)
if item.key == 'some_date':
self.assertEqual('2021-07-23', item.value)