diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py index 01a27e9c..7dbde949 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py @@ -829,7 +829,7 @@ class ProcessInstanceProcessor: process_instance_id=self.process_instance_model.id, key=key, ) - pim.value = data_for_key + pim.value = str(data_for_key)[0:255] db.session.add(pim) db.session.commit() diff --git a/spiffworkflow-backend/tests/data/nested-task-data-structure/nested-task-data-structure.bpmn b/spiffworkflow-backend/tests/data/nested-task-data-structure/nested-task-data-structure.bpmn index 7452216a..36acf7ab 100644 --- a/spiffworkflow-backend/tests/data/nested-task-data-structure/nested-task-data-structure.bpmn +++ b/spiffworkflow-backend/tests/data/nested-task-data-structure/nested-task-data-structure.bpmn @@ -21,7 +21,7 @@ outer['time'] = time.time_ns() Flow_18gs4jt Flow_1flxgry - outer["inner"] = 'sweet2' + outer["inner"] = 'sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2END_THIS_WILL_TRUNCATE_HERE' diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model.py index 22f92111..40a9c96e 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model.py @@ -1,4 +1,6 @@ """Process Model.""" +import re + from flask.app import Flask from flask.testing import FlaskClient from tests.spiffworkflow_backend.helpers.base_test import BaseTest @@ -21,7 +23,7 @@ class TestProcessModel(BaseTest): def test_initializes_files_as_empty_array(self) -> None: """Test_initializes_files_as_empty_array.""" - process_model_one = self.create_test_process_model(id="model_one", display_name="Model One") + process_model_one = self._create_test_process_model(id="model_one", display_name="Model One") assert process_model_one.files == [] def test_can_run_process_model_with_call_activities_when_in_same_process_model_directory( @@ -130,14 +132,17 @@ class TestProcessModel(BaseTest): process_instance_id=process_instance.id, key="awesome_var" ).first() assert process_instance_metadata_awesome_var is not None - assert process_instance_metadata_awesome_var.value == "sweet2" + + # notion 160: ensure that we truncate long values to 255 characters + assert re.match(r"^sweet2.*END$", process_instance_metadata_awesome_var.value) + assert len(process_instance_metadata_awesome_var.value) == 255 process_instance_metadata_awesome_var = ProcessInstanceMetadataModel.query.filter_by( process_instance_id=process_instance.id, key="invoice_number" ).first() assert process_instance_metadata_awesome_var is not None assert process_instance_metadata_awesome_var.value == "123" - def create_test_process_model(self, id: str, display_name: str) -> ProcessModelInfo: + def _create_test_process_model(self, id: str, display_name: str) -> ProcessModelInfo: """Create_test_process_model.""" return ProcessModelInfo( id=id,