pyl and i am not sure how mypy missed that one typing issue

This commit is contained in:
jasquat 2023-05-08 13:20:40 -04:00
parent eef920acae
commit 874fe9052c
2 changed files with 12 additions and 12 deletions

View File

@ -401,7 +401,7 @@ def _interstitial_stream(process_instance: ProcessInstanceModel) -> Generator[st
extensions = TaskService.get_extensions_from_task_model(task_model)
return _render_instructions_for_end_user(task_model, extensions)
def render_data(return_type: str, entity: Union[ApiError, Task]) -> str:
def render_data(return_type: str, entity: Union[ApiError, Task, ProcessInstanceModel]) -> str:
return_hash: dict = {"type": return_type}
return_hash[return_type] = entity
return f"data: {current_app.json.dumps(return_hash)} \n\n"

View File

@ -1689,11 +1689,11 @@ class TestProcessApi(BaseTest):
# The Manual Task should then return a message as well.
assert len(results) == 2
# import pdb; pdb.set_trace()
assert json_results[0]['task']["state"] == "READY"
assert json_results[0]['task']["title"] == "Script Task #2"
assert json_results[0]['task']["properties"]["instructionsForEndUser"] == "I am Script Task 2"
assert json_results[1]['task']["state"] == "READY"
assert json_results[1]['task']["title"] == "Manual Task"
assert json_results[0]["task"]["state"] == "READY"
assert json_results[0]["task"]["title"] == "Script Task #2"
assert json_results[0]["task"]["properties"]["instructionsForEndUser"] == "I am Script Task 2"
assert json_results[1]["task"]["state"] == "READY"
assert json_results[1]["task"]["title"] == "Manual Task"
response = client.put(
f"/v1.0/tasks/{process_instance_id}/{json_results[1]['task']['id']}",
@ -1706,10 +1706,10 @@ class TestProcessApi(BaseTest):
results = list(_dequeued_interstitial_stream(process_instance_id))
json_results = list(map(lambda x: json.loads(x[5:]), results)) # type: ignore
assert len(results) == 1
assert json_results[0]['task']["state"] == "READY"
assert json_results[0]['task']["can_complete"] is False
assert json_results[0]['task']["title"] == "Please Approve"
assert json_results[0]['task']["properties"]["instructionsForEndUser"] == "I am a manual task in another lane"
assert json_results[0]["task"]["state"] == "READY"
assert json_results[0]["task"]["can_complete"] is False
assert json_results[0]["task"]["title"] == "Please Approve"
assert json_results[0]["task"]["properties"]["instructionsForEndUser"] == "I am a manual task in another lane"
# Complete task as the finance user.
response = client.put(
@ -1723,8 +1723,8 @@ class TestProcessApi(BaseTest):
results = list(_dequeued_interstitial_stream(process_instance_id))
json_results = list(map(lambda x: json.loads(x[5:]), results)) # type: ignore
assert len(json_results) == 1
assert json_results[0]['task']["state"] == "COMPLETED"
assert json_results[0]['task']["properties"]["instructionsForEndUser"] == "I am the end task"
assert json_results[0]["task"]["state"] == "COMPLETED"
assert json_results[0]["task"]["properties"]["instructionsForEndUser"] == "I am the end task"
def test_process_instance_list_with_default_list(
self,