Better document workflow existing custom field test

This commit is contained in:
shamoon 2024-01-07 12:13:12 -08:00
parent 17c2dfa5bf
commit 35e81a2845

View File

@ -999,6 +999,14 @@ class TestWorkflows(DirectoriesMixin, FileSystemAssertsMixin, APITestCase):
self.assertEqual(doc.custom_fields.all().count(), 1) self.assertEqual(doc.custom_fields.all().count(), 1)
def test_document_updated_workflow_existing_custom_field(self): def test_document_updated_workflow_existing_custom_field(self):
"""
GIVEN:
- Existing workflow with UPDATED trigger and action that adds a custom field
WHEN:
- Document is updated that already contains the field
THEN:
- Document update succeeds without trying to re-create the field
"""
trigger = WorkflowTrigger.objects.create( trigger = WorkflowTrigger.objects.create(
type=WorkflowTrigger.WorkflowTriggerType.DOCUMENT_UPDATED, type=WorkflowTrigger.WorkflowTriggerType.DOCUMENT_UPDATED,
filter_has_document_type=self.dt, filter_has_document_type=self.dt,