Squashed 'SpiffWorkflow/' changes from 5664815a2..4195453a4

4195453a4 Merge commit 'b55571406634555736fc471e7a53ca8b22288980'
0629dcb9a added fix to SpiffWorkflow to deepcopy operation params before evaluating them w/ burnettk

git-subtree-dir: SpiffWorkflow
git-subtree-split: 4195453a46638f23e87c3ffdb038717c2d8abd00
This commit is contained in:
jasquat 2023-01-05 17:35:20 -05:00
parent b555714066
commit 3ff98fb51e
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,4 @@
from copy import deepcopy
import json
from SpiffWorkflow.bpmn.specs.ServiceTask import ServiceTask
from SpiffWorkflow.spiff.specs.spiff_task import SpiffBpmnTask
@ -27,7 +28,8 @@ class ServiceTask(SpiffBpmnTask, ServiceTask):
param['value'] = task.workflow.script_engine.evaluate(task, param['value'])
return param
evaluated_params = {k: evaluate(v) for k, v in self.operation_params.items()}
operation_params_copy = deepcopy(self.operation_params)
evaluated_params = {k: evaluate(v) for k, v in operation_params_copy.items()}
result = task.workflow.script_engine.call_service(self.operation_name,
evaluated_params, task.data)

View File

@ -60,6 +60,15 @@ class ServiceTaskTest(BaseTestCase):
self.workflow.do_engine_steps()
self._assert_service_tasks()
def testRunSameServiceTaskActivityMultipleTimes(self):
self.workflow.do_engine_steps()
service_task_activity = [t for t in self.workflow.get_tasks() if
t.task_spec.name == 'Activity-1inxqgx'][0]
service_task_activity.task_spec._execute(service_task_activity)
service_task_activity.task_spec._execute(service_task_activity)
service_task_activity.task_spec._execute(service_task_activity)
def testRunThroughSaveRestore(self):
self.save_restore()
# Engine isn't preserved through save/restore, so we have to reset it.