allow passing the script text as a string to run a unit test on w/ burnettk
This commit is contained in:
parent
d5837a2de6
commit
dee8d97d97
|
@ -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"
|
||||
# )
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue