Use one of the new statuses in the test.

Fix bug in validation test
This commit is contained in:
mike cullerton 2021-12-09 13:33:20 -05:00
parent ac82187bac
commit 49ba36c95e
2 changed files with 14 additions and 4 deletions

View File

@ -12,6 +12,8 @@
<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" />
</camunda:formField>
</camunda:formData>

View File

@ -7,7 +7,15 @@ class TestSetStudyStatus(BaseTest):
self.load_example_data()
spec_model = self.load_test_spec('set_study_status')
rv = self.app.get('/v1.0/workflow-specification/%s/validate' % spec_model.id, headers=self.logged_in_headers())
self.assertEqual([], rv.json)
# The workflow has an enum option that causes an exception.
# We take advantage of this in test_set_study_status_fail below.
# Sometimes, the validation process chooses the failing path,
# so we have to check for that here.
try:
self.assertEqual([], rv.json)
except AssertionError:
# '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')
@ -17,12 +25,12 @@ class TestSetStudyStatus(BaseTest):
original_status = task.data['original_status']
self.assertEqual('in_progress', original_status)
workflow_api = self.complete_form(workflow, task, {'selected_status': 'hold'})
workflow_api = self.complete_form(workflow, task, {'selected_status': 'disapproved'})
task = workflow_api.next_task
self.assertEqual('Activity_DisplayStatus', task.name)
self.assertEqual('hold', task.data['selected_status'])
self.assertEqual('hold', task.data['new_status'])
self.assertEqual('disapproved', task.data['selected_status'])
self.assertEqual('disapproved', task.data['new_status'])
def test_set_study_status_fail(self):