diff --git a/bin/save_all_bpmn.py b/bin/save_all_bpmn.py index ffe03377..cbeaebf0 100644 --- a/bin/save_all_bpmn.py +++ b/bin/save_all_bpmn.py @@ -50,7 +50,9 @@ def main(): bpmn_xml_file_contents, ) except Exception as ex: - failing_process_models.append((process_model.primary_file_name, str(ex))) + failing_process_models.append( + (process_model.primary_file_name, str(ex)) + ) # files = SpecFileService.get_files( # process_model, extension_filter="bpmn" # ) diff --git a/src/spiffworkflow_backend/routes/process_api_blueprint.py b/src/spiffworkflow_backend/routes/process_api_blueprint.py index c9e96e47..5fc5ecf6 100644 --- a/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -983,9 +983,9 @@ def script_unit_test_run( current_app.config["THREAD_LOCAL_DATA"].process_instance_id = None bpmn_task_identifier = get_required_parameter_or_raise("bpmn_task_identifier", body) - script_unit_test_identifier = get_required_parameter_or_raise( - "script_unit_test_identifier", body - ) + python_script = get_required_parameter_or_raise("python_script", body) + input_json = get_required_parameter_or_raise("input_json", body) + expected_output_json = get_required_parameter_or_raise("expected_output_json", body) bpmn_process_instance = ( ProcessInstanceProcessor.get_bpmn_process_instance_from_process_model( @@ -1005,7 +1005,9 @@ def script_unit_test_run( ) ) - result = ScriptUnitTestRunner.run_test(spiff_task, script_unit_test_identifier) + result = ScriptUnitTestRunner.run_with_task_and_script_and_pre_post_contexts( + spiff_task, python_script, input_json, expected_output_json + ) return make_response(jsonify(result), 200) diff --git a/src/spiffworkflow_backend/services/script_unit_test_runner.py b/src/spiffworkflow_backend/services/script_unit_test_runner.py index 19a366d5..f1a11378 100644 --- a/src/spiffworkflow_backend/services/script_unit_test_runner.py +++ b/src/spiffworkflow_backend/services/script_unit_test_runner.py @@ -4,7 +4,7 @@ from dataclasses import dataclass from typing import Any from typing import Optional -from SpiffWorkflow import Task as SpiffTask +from SpiffWorkflow import Task as SpiffTask # type: ignore from SpiffWorkflow.bpmn.exceptions import WorkflowTaskExecException # type: ignore from spiffworkflow_backend.services.process_instance_processor import ( @@ -48,7 +48,7 @@ class ScriptUnitTestRunner: result=False, error=f"Failed to execute script: {str(ex)}", line_number=ex.line_number, - offset=ex.offset + offset=ex.offset, ) except Exception as ex: return ScriptUnitTestResult(