fixed some failing tests except for test_send_event
This commit is contained in:
parent
7d1f01ee02
commit
c5806ee53d
|
@ -70,13 +70,13 @@ class TaskService:
|
|||
for child_spiff_task in spiff_task.children:
|
||||
if child_spiff_task._has_state(TaskState.PREDICTED_MASK):
|
||||
self.__class__.remove_spiff_task_from_parent(child_spiff_task, self.task_models)
|
||||
else:
|
||||
self.update_task_model_with_spiff_task(
|
||||
spiff_task=child_spiff_task,
|
||||
)
|
||||
self.process_spiff_task_children(
|
||||
spiff_task=child_spiff_task,
|
||||
)
|
||||
continue
|
||||
self.update_task_model_with_spiff_task(
|
||||
spiff_task=child_spiff_task,
|
||||
)
|
||||
self.process_spiff_task_children(
|
||||
spiff_task=child_spiff_task,
|
||||
)
|
||||
|
||||
def process_spiff_task_parents(
|
||||
self,
|
||||
|
@ -148,7 +148,6 @@ class TaskService:
|
|||
spiff_workflow: BpmnWorkflow,
|
||||
bpmn_process: BpmnProcessModel,
|
||||
) -> None:
|
||||
# import pdb; pdb.set_trace()
|
||||
new_properties_json = copy.copy(bpmn_process.properties_json)
|
||||
new_properties_json["last_task"] = str(spiff_workflow.last_task) if spiff_workflow.last_task else None
|
||||
new_properties_json["success"] = spiff_workflow.success
|
||||
|
|
|
@ -126,13 +126,12 @@ class ExecutionStrategy:
|
|||
def __init__(self, delegate: EngineStepDelegate):
|
||||
"""__init__."""
|
||||
self.delegate = delegate
|
||||
self.bpmn_process_instance = None
|
||||
|
||||
def do_engine_steps(self, bpmn_process_instance: BpmnWorkflow, exit_at: None = None) -> None:
|
||||
pass
|
||||
|
||||
def save(self) -> None:
|
||||
self.delegate.save(self.bpmn_process_instance)
|
||||
def save(self, bpmn_process_instance: BpmnWorkflow) -> None:
|
||||
self.delegate.save(bpmn_process_instance)
|
||||
|
||||
|
||||
class GreedyExecutionStrategy(ExecutionStrategy):
|
||||
|
@ -238,7 +237,7 @@ class WorkflowExecutionService:
|
|||
raise ApiError.from_workflow_exception("task_error", str(swe), swe) from swe
|
||||
|
||||
finally:
|
||||
self.execution_strategy.save()
|
||||
self.execution_strategy.save(self.bpmn_process_instance)
|
||||
db.session.commit()
|
||||
|
||||
if save:
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<bpmn:endEvent id="end_event_of_manual_task_model">
|
||||
<bpmn:incoming>Flow_0nnh2x9</bpmn:incoming>
|
||||
</bpmn:endEvent>
|
||||
<bpmn:sequenceFlow id="Flow_0nnh2x9" sourceRef="Activity_Hello" targetRef="end_event_of_manual_task_model" />
|
||||
<bpmn:manualTask id="Activity_Hello" name="Hello">
|
||||
<bpmn:sequenceFlow id="Flow_0nnh2x9" sourceRef="manual_task_one" targetRef="end_event_of_manual_task_model" />
|
||||
<bpmn:manualTask id="manual_task_one" name="Hello">
|
||||
<bpmn:extensionElements>
|
||||
<spiffworkflow:instructionsForEndUser>## Hello</spiffworkflow:instructionsForEndUser>
|
||||
</bpmn:extensionElements>
|
||||
|
@ -16,7 +16,7 @@
|
|||
<bpmn:outgoing>Flow_0nnh2x9</bpmn:outgoing>
|
||||
</bpmn:manualTask>
|
||||
<bpmn:sequenceFlow id="Flow_0stlaxe" sourceRef="StartEvent_1" targetRef="the_script" />
|
||||
<bpmn:sequenceFlow id="Flow_1pmem7s" sourceRef="the_script" targetRef="Activity_Hello" />
|
||||
<bpmn:sequenceFlow id="Flow_1pmem7s" sourceRef="the_script" targetRef="manual_task_one" />
|
||||
<bpmn:scriptTask id="the_script">
|
||||
<bpmn:incoming>Flow_0stlaxe</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_1pmem7s</bpmn:outgoing>
|
||||
|
@ -31,7 +31,7 @@
|
|||
<bpmndi:BPMNShape id="Event_0ia26nb_di" bpmnElement="end_event_of_manual_task_model">
|
||||
<dc:Bounds x="592" y="159" width="36" height="36" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Activity_1rcj16n_di" bpmnElement="Activity_Hello">
|
||||
<bpmndi:BPMNShape id="Activity_1rcj16n_di" bpmnElement="manual_task_one">
|
||||
<dc:Bounds x="420" y="137" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Activity_1vokg57_di" bpmnElement="the_script">
|
||||
|
|
|
@ -2616,6 +2616,8 @@ class TestProcessApi(BaseTest):
|
|||
content_type="application/json",
|
||||
data=json.dumps(data),
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert response.json is not None
|
||||
assert response.json["status"] == "complete"
|
||||
|
||||
response = client.get(
|
||||
|
@ -2641,9 +2643,9 @@ class TestProcessApi(BaseTest):
|
|||
) -> None:
|
||||
"""Test_script_unit_test_run."""
|
||||
process_group_id = "test_group"
|
||||
process_model_id = "process_navigation"
|
||||
bpmn_file_name = "process_navigation.bpmn"
|
||||
bpmn_file_location = "process_navigation"
|
||||
process_model_id = "manual_task"
|
||||
bpmn_file_name = "manual_task.bpmn"
|
||||
bpmn_file_location = "manual_task"
|
||||
process_model_identifier = self.create_group_and_model_with_bpmn(
|
||||
client=client,
|
||||
user=with_super_admin_user,
|
||||
|
@ -2674,25 +2676,11 @@ class TestProcessApi(BaseTest):
|
|||
headers=self.logged_in_headers(with_super_admin_user),
|
||||
)
|
||||
|
||||
data = {
|
||||
"dateTime": "PT1H",
|
||||
"external": True,
|
||||
"internal": True,
|
||||
"label": "Event_0e4owa3",
|
||||
"typename": "TimerEventDefinition",
|
||||
}
|
||||
response = client.post(
|
||||
f"/v1.0/send-event/{self.modify_process_identifier_for_path_param(process_model_identifier)}/{process_instance_id}",
|
||||
headers=self.logged_in_headers(with_super_admin_user),
|
||||
content_type="application/json",
|
||||
data=json.dumps(data),
|
||||
)
|
||||
|
||||
response = client.get(
|
||||
f"/v1.0/process-instances/{self.modify_process_identifier_for_path_param(process_model_identifier)}/{process_instance_id}/task-info",
|
||||
headers=self.logged_in_headers(with_super_admin_user),
|
||||
)
|
||||
assert len(response.json) == 9
|
||||
assert len(response.json) == 7
|
||||
human_task = next(task for task in response.json if task["bpmn_identifier"] == "manual_task_one")
|
||||
|
||||
response = client.post(
|
||||
|
@ -2711,7 +2699,7 @@ class TestProcessApi(BaseTest):
|
|||
headers=self.logged_in_headers(with_super_admin_user),
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert len(response.json) == 9
|
||||
assert len(response.json) == 7
|
||||
|
||||
def setup_initial_groups_for_move_tests(self, client: FlaskClient, with_super_admin_user: UserModel) -> None:
|
||||
"""Setup_initial_groups_for_move_tests."""
|
||||
|
|
|
@ -353,14 +353,24 @@ class TestProcessInstanceProcessor(BaseTest):
|
|||
|
||||
process_instance = ProcessInstanceModel.query.filter_by(id=process_instance.id).first()
|
||||
processor = ProcessInstanceProcessor(process_instance)
|
||||
# with open("after_reset.json", 'w') as f: f.write(json.dumps(processor.serialize(), indent=2))
|
||||
processor.resume()
|
||||
processor.do_engine_steps(save=True)
|
||||
human_task_one = process_instance.active_human_tasks[0]
|
||||
spiff_manual_task = processor.bpmn_process_instance.get_task_from_id(UUID(human_task_one.task_id))
|
||||
ProcessInstanceService.complete_form_task(processor, spiff_manual_task, {}, initiator_user, human_task_one)
|
||||
|
||||
assert process_instance.status == "complete"
|
||||
process_instance = ProcessInstanceModel.query.filter_by(id=process_instance.id).first()
|
||||
processor = ProcessInstanceProcessor(process_instance)
|
||||
human_task_one = process_instance.active_human_tasks[0]
|
||||
spiff_manual_task = processor.bpmn_process_instance.get_task_from_id(UUID(human_task_one.task_id))
|
||||
ProcessInstanceService.complete_form_task(processor, spiff_manual_task, {}, initiator_user, human_task_one)
|
||||
human_task_one = process_instance.active_human_tasks[0]
|
||||
spiff_manual_task = processor.bpmn_process_instance.get_task_from_id(UUID(human_task_one.task_id))
|
||||
ProcessInstanceService.complete_form_task(processor, spiff_manual_task, {}, initiator_user, human_task_one)
|
||||
|
||||
# recreate variables to ensure all bpmn json was recreated from scratch from the db
|
||||
process_instance_relookup = ProcessInstanceModel.query.filter_by(id=process_instance.id).first()
|
||||
assert process_instance_relookup.status == "complete"
|
||||
|
||||
def test_properly_saves_tasks_when_running(
|
||||
self,
|
||||
|
|
Loading…
Reference in New Issue