ran poet pre to delint and added type hints to fix poet mypy

This commit is contained in:
burnettk 2022-09-29 10:19:31 -04:00
parent 4905d40876
commit e8a34eb830
4 changed files with 29 additions and 27 deletions

View File

@ -376,8 +376,9 @@ class ProcessInstanceService:
return data
@staticmethod
def create_dot_dict(data: dict) -> Any:
dot_dict = {}
def create_dot_dict(data: dict) -> dict[str, Any]:
"""Create_dot_dict."""
dot_dict: dict[str, Any] = {}
for key, value in data.items():
ProcessInstanceService.set_dot_value(key, value, dot_dict)
return dot_dict

View File

@ -3,8 +3,12 @@ from flask.app import Flask
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from spiffworkflow_backend.services.process_instance_processor import ProcessInstanceProcessor
from spiffworkflow_backend.services.process_instance_service import ProcessInstanceService
from spiffworkflow_backend.services.process_instance_processor import (
ProcessInstanceProcessor,
)
from spiffworkflow_backend.services.process_instance_service import (
ProcessInstanceService,
)
class TestDotNotation(BaseTest):
@ -13,11 +17,11 @@ class TestDotNotation(BaseTest):
def test_dot_notation(
self, app: Flask, with_db_and_bpmn_file_cleanup: None
) -> None:
"""Test_form_data_conversion_to_dot_dict"""
"""Test_form_data_conversion_to_dot_dict."""
process_model = load_test_spec(
"test_dot_notation",
bpmn_file_name="diagram.bpmn",
process_model_source_directory="dot_notation"
process_model_source_directory="dot_notation",
)
current_user = self.find_or_create_user()
@ -30,26 +34,23 @@ class TestDotNotation(BaseTest):
user_task = processor.get_ready_user_tasks()[0]
form_data = {
'invoice.contibutorName': 'Elizabeth',
'invoice.contributorId': 100,
'invoice.invoiceId': 10001,
'invoice.invoiceAmount': '1000.00',
'invoice.dueDate': '09/30/2022',
"invoice.contibutorName": "Elizabeth",
"invoice.contributorId": 100,
"invoice.invoiceId": 10001,
"invoice.invoiceAmount": "1000.00",
"invoice.dueDate": "09/30/2022",
}
ProcessInstanceService.complete_form_task(
processor,
user_task,
form_data,
current_user
processor, user_task, form_data, current_user
)
expected = {
'contibutorName': 'Elizabeth',
'contributorId': 100,
'invoiceId': 10001,
'invoiceAmount': '1000.00',
'dueDate': '09/30/2022',
"contibutorName": "Elizabeth",
"contributorId": 100,
"invoiceId": 10001,
"invoiceAmount": "1000.00",
"dueDate": "09/30/2022",
}
processor.do_engine_steps(save=True)
assert processor.get_data()['invoice'] == expected
assert processor.get_data()["invoice"] == expected