Tests and workflow for the changes
This commit is contained in:
parent
4d832891c9
commit
daef419993
|
@ -0,0 +1,47 @@
|
|||
<?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_1mi5jsa" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.2.0">
|
||||
<bpmn:process id="Process_StudyProgressStatus" name="Study Progress Status" isExecutable="true">
|
||||
<bpmn:startEvent id="StartEvent_1" name="Start">
|
||||
<bpmn:outgoing>Flow_1iqprcz</bpmn:outgoing>
|
||||
</bpmn:startEvent>
|
||||
<bpmn:sequenceFlow id="Flow_1iqprcz" sourceRef="StartEvent_1" targetRef="Activity_GetStudyProgressStatus" />
|
||||
<bpmn:scriptTask id="Activity_GetStudyProgressStatus" name="Get Study Progress Status">
|
||||
<bpmn:incoming>Flow_1iqprcz</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_0npc38l</bpmn:outgoing>
|
||||
<bpmn:script>study_progress_status = get_study_progress_status()</bpmn:script>
|
||||
</bpmn:scriptTask>
|
||||
<bpmn:endEvent id="Event_005hgvx" name="Display Study Status">
|
||||
<bpmn:documentation># Study Progress Status
|
||||
{{ study_progress_status }}</bpmn:documentation>
|
||||
<bpmn:incoming>Flow_0npc38l</bpmn:incoming>
|
||||
</bpmn:endEvent>
|
||||
<bpmn:sequenceFlow id="Flow_0npc38l" sourceRef="Activity_GetStudyProgressStatus" targetRef="Event_005hgvx" />
|
||||
</bpmn:process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_StudyProgressStatus">
|
||||
<bpmndi:BPMNEdge id="Flow_0npc38l_di" bpmnElement="Flow_0npc38l">
|
||||
<di:waypoint x="370" y="117" />
|
||||
<di:waypoint x="432" y="117" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="Flow_1iqprcz_di" bpmnElement="Flow_1iqprcz">
|
||||
<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="99" width="36" height="36" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="186" y="142" width="24" height="14" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Activity_07bvb7w_di" bpmnElement="Activity_GetStudyProgressStatus">
|
||||
<dc:Bounds x="270" y="77" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Event_005hgvx_di" bpmnElement="Event_005hgvx">
|
||||
<dc:Bounds x="432" y="99" width="36" height="36" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="417" y="142" width="68" height="27" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</bpmn:definitions>
|
|
@ -9,9 +9,6 @@
|
|||
<camunda:formData>
|
||||
<camunda:formField id="selected_status" label="Select Study Status" type="enum">
|
||||
<camunda:value id="in_progress" name="In Progress" />
|
||||
<camunda:value id="hold" name="Hold" />
|
||||
<camunda:value id="open_for_enrollment" name="Open For Enrollment" />
|
||||
<camunda:value id="abandoned" name="Abandoned" />
|
||||
<camunda:value id="approved" name="Approved" />
|
||||
<camunda:value id="disapproved" name="Disapproved" />
|
||||
<camunda:value id="asdf" name="asdf" />
|
||||
|
@ -25,7 +22,7 @@
|
|||
<bpmn:scriptTask id="Activity_SetSelectedStatus" name="Set Selected Status">
|
||||
<bpmn:incoming>Flow_0q0rtvj</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_0ana8xt</bpmn:outgoing>
|
||||
<bpmn:script>returned_status = set_study_status(selected_status)</bpmn:script>
|
||||
<bpmn:script>returned_status = set_study_progress_status(selected_status)</bpmn:script>
|
||||
</bpmn:scriptTask>
|
||||
<bpmn:sequenceFlow id="Flow_0ana8xt" sourceRef="Activity_SetSelectedStatus" targetRef="Activity_GetNewStatus" />
|
||||
<bpmn:manualTask id="Activity_DisplayStatus" name="Display Status">
|
||||
|
@ -55,13 +52,13 @@
|
|||
<bpmn:scriptTask id="Activity_GetOriginalStatus" name="Get Original Status">
|
||||
<bpmn:incoming>Flow_0c77bdh</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_1e9oiuw</bpmn:outgoing>
|
||||
<bpmn:script>original_status = get_study_status()</bpmn:script>
|
||||
<bpmn:script>original_status = get_study_progress_status()</bpmn:script>
|
||||
</bpmn:scriptTask>
|
||||
<bpmn:sequenceFlow id="Flow_0nckhhn" sourceRef="Activity_GetNewStatus" targetRef="Activity_DisplayStatus" />
|
||||
<bpmn:scriptTask id="Activity_GetNewStatus" name="Get New Status">
|
||||
<bpmn:incoming>Flow_0ana8xt</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_0nckhhn</bpmn:outgoing>
|
||||
<bpmn:script>new_status = get_study_status()</bpmn:script>
|
||||
<bpmn:script>new_status = get_study_progress_status()</bpmn:script>
|
||||
</bpmn:scriptTask>
|
||||
</bpmn:process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
from tests.base_test import BaseTest
|
||||
|
||||
from crc import session
|
||||
from crc.models.study import StudyModel, ProgressStatus
|
||||
|
||||
|
||||
class TestGetStudyProgressStatus(BaseTest):
|
||||
|
||||
def test_get_study_progress_status(self):
|
||||
workflow = self.create_workflow('get_study_progress_status')
|
||||
study_model = session.query(StudyModel).filter(StudyModel.id == workflow.study_id).first()
|
||||
study_model.progress_status = ProgressStatus.approved
|
||||
workflow_api = self.get_workflow_api(workflow)
|
||||
task = workflow_api.next_task
|
||||
|
||||
self.assertEqual(task.data['study_progress_status'], workflow.study.progress_status.value)
|
|
@ -1,14 +1,16 @@
|
|||
from tests.base_test import BaseTest
|
||||
|
||||
from crc.models.study import ProgressStatus
|
||||
|
||||
class TestSetStudyStatus(BaseTest):
|
||||
|
||||
def test_set_study_status_validation(self):
|
||||
class TestSetStudyProgressStatus(BaseTest):
|
||||
|
||||
def test_set_study_progress_status_validation(self):
|
||||
self.load_example_data()
|
||||
spec_model = self.load_test_spec('set_study_status')
|
||||
spec_model = self.load_test_spec('set_study_progress_status')
|
||||
rv = self.app.get('/v1.0/workflow-specification/%s/validate' % spec_model.id, headers=self.logged_in_headers())
|
||||
# The workflow has an enum option that causes an exception.
|
||||
# We take advantage of this in test_set_study_status_fail below.
|
||||
# We take advantage of this in test_set_study_progress_status_fail below.
|
||||
# Sometimes, the validation process chooses the failing path,
|
||||
# so we have to check for that here.
|
||||
try:
|
||||
|
@ -17,8 +19,9 @@ class TestSetStudyStatus(BaseTest):
|
|||
# 'asdf' is the failing enum option
|
||||
self.assertEqual('asdf', rv.json[0]['task_data']['selected_status'])
|
||||
|
||||
def test_set_study_status(self):
|
||||
workflow = self.create_workflow('set_study_status')
|
||||
def test_set_study_progress_status(self):
|
||||
workflow = self.create_workflow('set_study_progress_status')
|
||||
workflow.study.progress_status = ProgressStatus.in_progress
|
||||
workflow_api = self.get_workflow_api(workflow)
|
||||
task = workflow_api.next_task
|
||||
|
||||
|
@ -32,10 +35,10 @@ class TestSetStudyStatus(BaseTest):
|
|||
self.assertEqual('disapproved', task.data['selected_status'])
|
||||
self.assertEqual('disapproved', task.data['new_status'])
|
||||
|
||||
def test_set_study_status_fail(self):
|
||||
def test_set_study_progress_status_fail(self):
|
||||
|
||||
self.load_example_data()
|
||||
workflow = self.create_workflow('set_study_status')
|
||||
workflow = self.create_workflow('set_study_progress_status')
|
||||
workflow_api = self.get_workflow_api(workflow)
|
||||
task = workflow_api.next_task
|
||||
|
||||
|
|
Loading…
Reference in New Issue