From 17077be701dc403a3863e63f3635a705da537cb0 Mon Sep 17 00:00:00 2001 From: NWalker4483 Date: Wed, 9 Jun 2021 12:40:38 -0400 Subject: [PATCH] exit at task --- .vscode/launch.json | 15 +++++++++++++++ crc/services/workflow_service.py | 10 +++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..bc8f6b62 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Current File", + "type": "python", + "request": "launch", + "program": "run.py", + "console": "integratedTerminal" + } + ] +} \ No newline at end of file diff --git a/crc/services/workflow_service.py b/crc/services/workflow_service.py index ee37c688..db3ef8d1 100644 --- a/crc/services/workflow_service.py +++ b/crc/services/workflow_service.py @@ -80,13 +80,15 @@ class WorkflowService(object): db.session.delete(user) @staticmethod - def test_spec(spec_id, required_only=False): + def test_spec(spec_id, required_only=False, test_until = ""): """Runs a spec through it's paces to see if it results in any errors. Not fool-proof, but a good sanity check. Returns the final data output form the last task if successful. required_only can be set to true, in which case this will run the spec, only completing the required fields, rather than everything. + + testing_depth """ workflow_model = WorkflowService.make_test_workflow(spec_id) @@ -98,6 +100,7 @@ class WorkflowService(object): raise ApiError.from_workflow_exception("workflow_validation_exception", str(we), we) count = 0 + while not processor.bpmn_workflow.is_completed(): if count < 100: # check for infinite loop try: @@ -121,6 +124,11 @@ class WorkflowService(object): task_name=task.get_name()) WorkflowService.populate_form_with_random_data(task, task_api, required_only) processor.complete_task(task) + a = task.get_data() + if test_until == task.name: + test_data = processor.bpmn_workflow.last_task.data + WorkflowService.delete_test_data() + return test_data count += 1 except WorkflowException as we: WorkflowService.delete_test_data()