truncate process model metadata w/ burnettk

This commit is contained in:
jasquat 2023-03-30 16:54:31 -04:00
parent 2feaf68132
commit 57aa8d45b1
No known key found for this signature in database
3 changed files with 10 additions and 5 deletions

View File

@ -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()

View File

@ -21,7 +21,7 @@ outer['time'] = time.time_ns()</bpmn:script>
<bpmn:scriptTask id="Activity_1bvyv67" name="First setting of data">
<bpmn:incoming>Flow_18gs4jt</bpmn:incoming>
<bpmn:outgoing>Flow_1flxgry</bpmn:outgoing>
<bpmn:script>outer["inner"] = 'sweet2'</bpmn:script>
<bpmn:script>outer["inner"] = 'sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2sweet2END_THIS_WILL_TRUNCATE_HERE'</bpmn:script>
</bpmn:scriptTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">

View File

@ -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,