diff --git a/tests/data/status/pb_responses.dmn b/tests/data/status/pb_responses.dmn new file mode 100644 index 00000000..c91ec047 --- /dev/null +++ b/tests/data/status/pb_responses.dmn @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + false + + + false + + + + + true + + + true + + + + + diff --git a/tests/data/status/random_fact.dmn b/tests/data/status/random_fact.dmn new file mode 100644 index 00000000..8768deb9 --- /dev/null +++ b/tests/data/status/random_fact.dmn @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + false + + + false + + + + + true + + + true + + + + + diff --git a/tests/data/status/status.bpmn b/tests/data/status/status.bpmn new file mode 100644 index 00000000..dd749bf7 --- /dev/null +++ b/tests/data/status/status.bpmn @@ -0,0 +1,144 @@ + + + + + SequenceFlow_1ees8ka + + + + Flow_1nimppb + Flow_1txrak2 + + + Flow_1m8285h + Flow_1sggkit + + + Flow_18pl92p + Flow_0x9580l + + + Flow_03u23vt + Flow_0pkxa8l + + + Flow_024q2cw + Flow_1m8285h + Flow_1nimppb + Flow_03u23vt + Flow_18pl92p + + + + + + + Flow_1txrak2 + Flow_0pkxa8l + Flow_1sggkit + Flow_0x9580l + Flow_0pwtiqm + + + + Flow_0pwtiqm + + + + + + + + + + + + + SequenceFlow_1ees8ka + Flow_024q2cw + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/status/study_details.dmn b/tests/data/status/study_details.dmn new file mode 100644 index 00000000..dfca8117 --- /dev/null +++ b/tests/data/status/study_details.dmn @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + false + + + false + + + + + true + + + true + + + + + diff --git a/tests/data/status/two_forms.dmn b/tests/data/status/two_forms.dmn new file mode 100644 index 00000000..ca68ac3c --- /dev/null +++ b/tests/data/status/two_forms.dmn @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + false + + + false + + + + + true + + + true + + + + + diff --git a/tests/test_workflow_processor.py b/tests/test_workflow_processor.py index 258ab195..fed34567 100644 --- a/tests/test_workflow_processor.py +++ b/tests/test_workflow_processor.py @@ -323,3 +323,28 @@ class TestWorkflowProcessor(BaseTest): workflow_spec_model = self.load_test_spec("two_forms") version = WorkflowProcessor.get_latest_version_string("two_forms") self.assertTrue(version.startswith("v1 ")) + + def test_status_bpmn(self): + self.load_example_data() + study = session.query(StudyModel).first() + workflow_spec_model = self.load_test_spec("status") + + for enabled in [True, False]: + processor = WorkflowProcessor.create(study.id, workflow_spec_model.id) + task = processor.next_task() + + # Turn all specs on or off + task.data = {"some_input": enabled} + processor.complete_task(task) + + # Finish out rest of workflow + while processor.get_status() == WorkflowStatus.waiting: + task = processor.next_task() + processor.complete_task(task) + + self.assertEqual(processor.get_status(), WorkflowStatus.complete) + + # Enabled status of all specs should match the value set in the first task + for spec_id in ['two_forms', 'random_fact', 'pb_responses', 'study_details']: + self.assertEqual(task.data[spec_id], enabled) +