snapshot: preserve custom field parity across forms timeline and pdf
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from django.test import TestCase
|
||||
|
||||
from workflows.models import FormFieldConfig, FormSectionConfig, OffboardingRequest, OnboardingRequest
|
||||
from workflows.models import FormCustomFieldConfig, FormFieldConfig, FormSectionConfig, OffboardingRequest, OnboardingRequest
|
||||
from workflows.pdf_sections import build_pdf_sections
|
||||
|
||||
|
||||
@@ -94,3 +94,32 @@ class PDFSectionBuilderTests(TestCase):
|
||||
self.assertIn('last_working_day', [field['name'] for field in austritt['fields']])
|
||||
date_field = next(field for field in austritt['fields'] if field['name'] == 'last_working_day')
|
||||
self.assertTrue(date_field['display_value'])
|
||||
|
||||
def test_custom_fields_are_included_in_pdf_sections(self):
|
||||
FormCustomFieldConfig.objects.create(
|
||||
form_type='onboarding',
|
||||
field_key='office_location',
|
||||
section_key='stammdaten',
|
||||
sort_order=0,
|
||||
field_type='text',
|
||||
is_active=True,
|
||||
label='Bürostandort',
|
||||
)
|
||||
request_obj = OnboardingRequest.objects.create(
|
||||
full_name='Max Mustermann',
|
||||
gender='herr',
|
||||
job_title='Consultant',
|
||||
department='IT-Service',
|
||||
work_email='max.mustermann@workdock.de',
|
||||
contract_start='2026-11-01',
|
||||
employment_type='unbefristet',
|
||||
agreement='accepted',
|
||||
custom_field_values={'office_location': 'Berlin Mitte'},
|
||||
)
|
||||
|
||||
sections = build_pdf_sections('onboarding', request_obj, 'de')
|
||||
stammdaten = next(section for section in sections if section['key'] == 'stammdaten')
|
||||
custom_field = next(field for field in stammdaten['fields'] if field['name'] == 'custom__office_location')
|
||||
|
||||
self.assertEqual(custom_field['label'], 'Bürostandort')
|
||||
self.assertEqual(custom_field['display_value'], 'Berlin Mitte')
|
||||
|
||||
Reference in New Issue
Block a user