pyl w/ burnettk

This commit is contained in:
jasquat 2023-03-16 16:18:02 -04:00
parent 5c0d72ab91
commit d75d66c33f
5 changed files with 15 additions and 8 deletions

View File

@ -1583,7 +1583,10 @@ class ProcessInstanceProcessor:
finally:
# clear out failling spiff tasks here since the ProcessInstanceProcessor creates an instance of the
# script engine on a class variable.
if hasattr(self._script_engine, "failing_spiff_task") and self._script_engine.failing_spiff_task is not None:
if (
hasattr(self._script_engine, "failing_spiff_task")
and self._script_engine.failing_spiff_task is not None
):
self._script_engine.failing_spiff_task = None
# log the spiff step details so we know what is processing the process

View File

@ -204,7 +204,7 @@ class TaskService:
bpmn_process_json_data = cls.update_task_data_on_bpmn_process(bpmn_process, bpmn_process_data_dict)
if bpmn_process_json_data is not None:
new_json_data_dicts[bpmn_process_json_data['hash']] = bpmn_process_json_data
new_json_data_dicts[bpmn_process_json_data["hash"]] = bpmn_process_json_data
if bpmn_process_parent is None:
process_instance.bpmn_process = bpmn_process

View File

@ -126,7 +126,9 @@ class TaskModelSavingDelegate(EngineStepDelegate):
bpmn_definition_to_task_definitions_mappings=self.bpmn_definition_to_task_definitions_mappings,
)
)
bpmn_process_json_data = TaskService.update_task_data_on_bpmn_process(bpmn_process or task_model.bpmn_process, spiff_task.workflow.data)
bpmn_process_json_data = TaskService.update_task_data_on_bpmn_process(
bpmn_process or task_model.bpmn_process, spiff_task.workflow.data
)
self.task_models.update(new_task_models)
self.json_data_dicts.update(new_json_data_dicts)
json_data_dict_list = TaskService.update_task_model(task_model, spiff_task, self.serializer)

View File

@ -1,6 +1,5 @@
"""Test Process Api Blueprint."""
import io
from SpiffWorkflow.task import TaskState
import json
import os
import time
@ -10,6 +9,7 @@ from typing import Dict
import pytest
from flask.app import Flask
from flask.testing import FlaskClient
from SpiffWorkflow.task import TaskState # type: ignore
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec

View File

@ -5,11 +5,11 @@ import pytest
from flask import g
from flask.app import Flask
from flask.testing import FlaskClient
from SpiffWorkflow.task import TaskState
from spiffworkflow_backend.exceptions.api_error import ApiError # type: ignore
from SpiffWorkflow.task import TaskState # type: ignore
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from spiffworkflow_backend.exceptions.api_error import ApiError
from spiffworkflow_backend.models.group import GroupModel
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
from spiffworkflow_backend.models.process_instance import ProcessInstanceStatus
@ -319,7 +319,7 @@ class TestProcessInstanceProcessor(BaseTest):
**{"set_in_test_process_to_call_script": 1},
}
fourth_data_set = {**third_data_set, **{"a": 1, "we_move_on": True}}
fifth_data_set = {**fourth_data_set, **{'validate_only': False, 'set_top_level_process_script_after_gate': 1}}
fifth_data_set = {**fourth_data_set, **{"validate_only": False, "set_top_level_process_script_after_gate": 1}}
expected_task_data = {
"top_level_script": first_data_set,
"manual_task": first_data_set,
@ -499,7 +499,9 @@ class TestProcessInstanceProcessor(BaseTest):
process_instance_final = ProcessInstanceModel.query.filter_by(id=process_instance.id).first()
processor_final = ProcessInstanceProcessor(process_instance_final)
spiff_task = processor_final.get_task_by_bpmn_identifier("script_task_two", processor_final.bpmn_process_instance)
spiff_task = processor_final.get_task_by_bpmn_identifier(
"script_task_two", processor_final.bpmn_process_instance
)
assert spiff_task is not None
assert spiff_task.state == TaskState.WAITING
assert spiff_task.data == {"my_var": "THE VAR"}