Test and workflow for new `get_irb_info` script

This commit is contained in:
mike cullerton 2021-05-01 15:53:43 -04:00
parent 060ee5076d
commit 9465b6408d
2 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,52 @@
<?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_1e8c8os" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.5.0">
<bpmn:process id="Process_GetIRBInfo" name="Get IRB Info" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>SequenceFlow_0xey0zw</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="SequenceFlow_0xey0zw" sourceRef="StartEvent_1" targetRef="Task_GetInfo" />
<bpmn:scriptTask id="Task_GetInfo" name="Get IRB Info">
<bpmn:incoming>SequenceFlow_0xey0zw</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_03hympo</bpmn:outgoing>
<bpmn:script>irb_info = get_irb_info()</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="SequenceFlow_03hympo" sourceRef="Task_GetInfo" targetRef="Task_PrintInfo" />
<bpmn:endEvent id="EndEvent_0qdzlqr">
<bpmn:incoming>SequenceFlow_1s6cthx</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_1s6cthx" sourceRef="Task_PrintInfo" targetRef="EndEvent_0qdzlqr" />
<bpmn:manualTask id="Task_PrintInfo" name="Print IRB Info">
<bpmn:documentation>IRB Info: {{irb_info}}</bpmn:documentation>
<bpmn:incoming>SequenceFlow_03hympo</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1s6cthx</bpmn:outgoing>
</bpmn:manualTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_GetIRBInfo">
<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_0xey0zw_di" bpmnElement="SequenceFlow_0xey0zw">
<di:waypoint x="215" y="117" />
<di:waypoint x="270" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0xmrk10_di" bpmnElement="Task_GetInfo">
<dc:Bounds x="270" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_03hympo_di" bpmnElement="SequenceFlow_03hympo">
<di:waypoint x="370" y="117" />
<di:waypoint x="430" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_0qdzlqr_di" bpmnElement="EndEvent_0qdzlqr">
<dc:Bounds x="592" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1s6cthx_di" bpmnElement="SequenceFlow_1s6cthx">
<di:waypoint x="530" y="117" />
<di:waypoint x="592" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ManualTask_1uh1r6q_di" bpmnElement="Task_PrintInfo">
<dc:Bounds x="430" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

View File

@ -0,0 +1,16 @@
from tests.base_test import BaseTest
from crc.services.protocol_builder import ProtocolBuilderService
from crc import app, session
class TestIRBInfo(BaseTest):
def test_irb_info_script(self):
app.config['PB_ENABLED'] = True
workflow = self.create_workflow('irb_info_script')
irb_info = ProtocolBuilderService.get_irb_info(workflow.study_id)
workflow_api = self.get_workflow_api(workflow)
first_task = workflow_api.next_task
self.assertEqual('Task_PrintInfo', first_task.name)
self.assertEqual(f'IRB Info: {irb_info}', first_task.documentation)