From c4b52f85af7288e003c679772b44b98a48bee492 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Wed, 17 Mar 2021 14:52:50 -0400 Subject: [PATCH] Test and workflow for testing infinite loop code. --- tests/data/infinite_loop/infinite_loop.bpmn | 97 +++++++++++++++++++ tests/workflow/test_workflow_infinite_loop.py | 13 +++ 2 files changed, 110 insertions(+) create mode 100644 tests/data/infinite_loop/infinite_loop.bpmn create mode 100644 tests/workflow/test_workflow_infinite_loop.py diff --git a/tests/data/infinite_loop/infinite_loop.bpmn b/tests/data/infinite_loop/infinite_loop.bpmn new file mode 100644 index 00000000..7fb41c13 --- /dev/null +++ b/tests/data/infinite_loop/infinite_loop.bpmn @@ -0,0 +1,97 @@ + + + + + Flow_0ldlhrt + + + + Flow_0ldlhrt + Flow_05mrx8v + Flow_0pddur1 + investigators = study_info('investigators') + + + + Investigators: {{ investigators }} + Flow_0pddur1 + Flow_03m3cuy + + + Flow_03m3cuy + Flow_05mrx8v + Flow_1212fe2 + + + + + hasattr(investigators, 'DEPT_CH') + + + Flow_14jn215 + + + + # Thank You + Flow_1212fe2 + Flow_14jn215 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/workflow/test_workflow_infinite_loop.py b/tests/workflow/test_workflow_infinite_loop.py new file mode 100644 index 00000000..a9846084 --- /dev/null +++ b/tests/workflow/test_workflow_infinite_loop.py @@ -0,0 +1,13 @@ +from tests.base_test import BaseTest +from crc import app +import json + + +class TestWorkflowInfiniteLoop(BaseTest): + + def test_workflow_infinite_loop(self): + self.load_example_data() + spec_model = self.load_test_spec('infinite_loop') + rv = self.app.get('/v1.0/workflow-specification/%s/validate' % spec_model.id, headers=self.logged_in_headers()) + json_data = json.loads(rv.get_data(as_text=True)) + self.assertIn('There appears to be an infinite loop', json_data[0]['message'])