From 71e20c9f4d7cbebd25e7ae557653289077701016 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 26 Jan 2023 07:35:13 -0500 Subject: [PATCH] set the correct type for task since SpiffTask and a backend task are not the same --- src/spiffworkflow_backend/routes/tasks_controller.py | 6 +++++- tests/spiffworkflow_backend/integration/test_process_api.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/spiffworkflow_backend/routes/tasks_controller.py b/src/spiffworkflow_backend/routes/tasks_controller.py index e773b661..4b2fbf42 100644 --- a/src/spiffworkflow_backend/routes/tasks_controller.py +++ b/src/spiffworkflow_backend/routes/tasks_controller.py @@ -34,6 +34,7 @@ from spiffworkflow_backend.models.human_task_user import HumanTaskUserModel from spiffworkflow_backend.models.process_instance import ProcessInstanceModel from spiffworkflow_backend.models.process_instance import ProcessInstanceStatus from spiffworkflow_backend.models.process_model import ProcessModelInfo +from spiffworkflow_backend.models.task import Task from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.routes.process_api_blueprint import ( _find_principal_or_raise, @@ -574,9 +575,12 @@ def _get_spiff_task_from_process_instance( # originally from: https://bitcoden.com/answers/python-nested-dictionary-update-value-where-any-nested-key-matches def _update_form_schema_with_task_data_as_needed( - in_dict: dict, task: SpiffTask + in_dict: dict, task: Task ) -> None: """Update_nested.""" + if task.data is None: + return None + for k, value in in_dict.items(): if "anyOf" == k: # value will look like the array on the right of "anyOf": ["options_from_task_data_var:awesome_options"] diff --git a/tests/spiffworkflow_backend/integration/test_process_api.py b/tests/spiffworkflow_backend/integration/test_process_api.py index 302ba9d5..f52cbc43 100644 --- a/tests/spiffworkflow_backend/integration/test_process_api.py +++ b/tests/spiffworkflow_backend/integration/test_process_api.py @@ -1680,6 +1680,7 @@ class TestProcessApi(BaseTest): f"/v1.0/tasks/{process_instance_id}/{human_task.task_id}", headers=self.logged_in_headers(with_super_admin_user), ) + assert response.status_code == 200 assert response.json is not None assert ( response.json["form_schema"]["definitions"]["Color"]["anyOf"][1]["title"]