2021-01-13 21:12:14 +00:00
|
|
|
from tests.base_test import BaseTest
|
|
|
|
|
|
|
|
|
|
|
|
class TestMessageEvent(BaseTest):
|
|
|
|
|
|
|
|
def test_message_event(self):
|
|
|
|
|
|
|
|
workflow = self.create_workflow('message_event')
|
|
|
|
|
|
|
|
first_task = self.get_workflow_api(workflow).next_task
|
|
|
|
self.assertEqual('Activity_GetData', first_task.name)
|
2021-01-14 20:32:14 +00:00
|
|
|
workflow_api = self.get_workflow_api(workflow)
|
2021-01-19 20:15:44 +00:00
|
|
|
|
2021-01-14 20:32:14 +00:00
|
|
|
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'])
|
2021-01-19 20:15:44 +00:00
|
|
|
|
|
|
|
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)
|
2021-01-14 20:32:14 +00:00
|
|
|
self.assertNotIn('formdata', workflow_api.next_task.data)
|
2021-01-13 21:12:14 +00:00
|
|
|
|
|
|
|
print('Nice Test')
|