Fixes from changing workflow_id to workflow_spec_id

This commit is contained in:
mike cullerton 2021-10-12 13:46:05 -04:00
parent 32aa1fba85
commit f41406a6d9
2 changed files with 11 additions and 10 deletions

View File

@ -8,7 +8,7 @@
<bpmn:userTask id="Activity_GetData" name="Get Data" camunda:formKey="DataForm"> <bpmn:userTask id="Activity_GetData" name="Get Data" camunda:formKey="DataForm">
<bpmn:extensionElements> <bpmn:extensionElements>
<camunda:formData> <camunda:formData>
<camunda:formField id="workflow_id" label="Workflow ID" type="string" /> <camunda:formField id="workflow_spec_id" label="Workflow Spec ID" type="string" />
</camunda:formData> </camunda:formData>
</bpmn:extensionElements> </bpmn:extensionElements>
<bpmn:incoming>Flow_1erkgz2</bpmn:incoming> <bpmn:incoming>Flow_1erkgz2</bpmn:incoming>
@ -18,7 +18,7 @@
<bpmn:scriptTask id="Activity_GetEmailData" name="Get Email Data"> <bpmn:scriptTask id="Activity_GetEmailData" name="Get Email Data">
<bpmn:incoming>Flow_1ira7x5</bpmn:incoming> <bpmn:incoming>Flow_1ira7x5</bpmn:incoming>
<bpmn:outgoing>Flow_1bt23l3</bpmn:outgoing> <bpmn:outgoing>Flow_1bt23l3</bpmn:outgoing>
<bpmn:script>email_data = get_email_data(email_workflow_id=workflow_id)</bpmn:script> <bpmn:script>email_data = get_email_data(workflow_spec_id=workflow_spec_id)</bpmn:script>
</bpmn:scriptTask> </bpmn:scriptTask>
<bpmn:sequenceFlow id="Flow_1bt23l3" sourceRef="Activity_GetEmailData" targetRef="Activity_DisplayEmailData" /> <bpmn:sequenceFlow id="Flow_1bt23l3" sourceRef="Activity_GetEmailData" targetRef="Activity_DisplayEmailData" />
<bpmn:manualTask id="Activity_DisplayEmailData" name="Display Email Data"> <bpmn:manualTask id="Activity_DisplayEmailData" name="Display Email Data">

View File

@ -9,7 +9,8 @@ class TestGetEmailData(BaseTest):
def test_get_email_data_by_email_id(self): def test_get_email_data_by_email_id(self):
self.load_example_data() self.load_example_data()
study = session.query(StudyModel).first() workflow = self.create_workflow('get_email_data')
study = workflow.study
with mail.record_messages() as outbox: with mail.record_messages() as outbox:
# Send an email we can use for get_email_data # Send an email we can use for get_email_data
email_model = EmailService.add_email(subject='My Email Subject', email_model = EmailService.add_email(subject='My Email Subject',
@ -17,7 +18,6 @@ class TestGetEmailData(BaseTest):
recipients=['joe@example.com'], recipients=['joe@example.com'],
content='asdf', content_html=None, study_id=study.id) content='asdf', content_html=None, study_id=study.id)
workflow = self.create_workflow('get_email_data')
workflow_api = self.get_workflow_api(workflow) workflow_api = self.get_workflow_api(workflow)
task = workflow_api.next_task task = workflow_api.next_task
@ -34,10 +34,12 @@ class TestGetEmailData(BaseTest):
self.assertEqual('sender@example.com', email_data[0]['sender']) self.assertEqual('sender@example.com', email_data[0]['sender'])
self.assertEqual('[\'joe@example.com\']', email_data[0]['recipients']) self.assertEqual('[\'joe@example.com\']', email_data[0]['recipients'])
def test_get_email_data_by_workflow_id(self): def test_get_email_data_by_workflow_spec_id(self):
self.load_example_data() self.load_example_data()
study = session.query(StudyModel).first() workflow = self.create_workflow('get_email_data_by_workflow')
study = workflow.study
email_workflow = session.query(WorkflowModel).first() email_workflow = session.query(WorkflowModel).first()
email_workflow_spec_id = email_workflow.workflow_spec_id
with mail.record_messages() as outbox: with mail.record_messages() as outbox:
# Send an email we can use for get_email_data # Send an email we can use for get_email_data
@ -47,21 +49,20 @@ class TestGetEmailData(BaseTest):
content='asdf', content='asdf',
content_html=None, content_html=None,
study_id=study.id, study_id=study.id,
workflow_id=email_workflow.id) workflow_spec_id=email_workflow_spec_id)
email_model_two = EmailService.add_email(subject='My Other Email Subject', email_model_two = EmailService.add_email(subject='My Other Email Subject',
sender='sender2@example.com', sender='sender2@example.com',
recipients=['joanne@example.com'], recipients=['joanne@example.com'],
content='xyzpdq', content='xyzpdq',
content_html=None, content_html=None,
study_id=study.id, study_id=study.id,
workflow_id=email_workflow.id) workflow_spec_id=email_workflow_spec_id)
workflow = self.create_workflow('get_email_data_by_workflow')
workflow_api = self.get_workflow_api(workflow) workflow_api = self.get_workflow_api(workflow)
task = workflow_api.next_task task = workflow_api.next_task
# Run workflow with get_email_data # Run workflow with get_email_data
workflow_api = self.complete_form(workflow, task, {'workflow_id': email_workflow.id}) workflow_api = self.complete_form(workflow, task, {'workflow_spec_id': email_workflow_spec_id})
task = workflow_api.next_task task = workflow_api.next_task
data = task.data data = task.data