From 9281a93abb58d5e61b80dbb7f3effbe59642e59d Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Tue, 19 Jan 2021 15:15:44 -0500 Subject: [PATCH] New test for new restart_workflow endpoint --- tests/workflow/test_workflow_restart.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/workflow/test_workflow_restart.py b/tests/workflow/test_workflow_restart.py index bac7a361..dddbffeb 100644 --- a/tests/workflow/test_workflow_restart.py +++ b/tests/workflow/test_workflow_restart.py @@ -5,16 +5,30 @@ class TestMessageEvent(BaseTest): def test_message_event(self): - # self.load_example_data() workflow = self.create_workflow('message_event') first_task = self.get_workflow_api(workflow).next_task self.assertEqual('Activity_GetData', first_task.name) workflow_api = self.get_workflow_api(workflow) + result = self.complete_form(workflow_api, first_task, {'formdata': 'asdf'}) self.assertIn('formdata', result.next_task.data) self.assertEqual('asdf', result.next_task.data['formdata']) - workflow_api = self.get_workflow_api(workflow_api, clear_data=True) + + workflow_api = self.get_workflow_api(workflow) + self.assertEqual('Activity_HowMany', self.get_workflow_api(workflow_api).next_task.name) + + # restart with data. should land at beginning with data + workflow_api = self.restart_workflow_api(result) + first_task = self.get_workflow_api(workflow_api).next_task + self.assertEqual('Activity_GetData', first_task.name) + self.assertIn('formdata', workflow_api.next_task.data) + self.assertEqual('asdf', workflow_api.next_task.data['formdata']) + + # restart without data. + workflow_api = self.restart_workflow_api(workflow_api, clear_data=True) + first_task = self.get_workflow_api(workflow).next_task + self.assertEqual('Activity_GetData', first_task.name) self.assertNotIn('formdata', workflow_api.next_task.data) print('Nice Test')