snapshot: preserve dynamic builder and section ordering work
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from django.test import TestCase
|
||||
|
||||
from workflows.models import FormCustomFieldConfig, FormFieldConfig, FormSectionConfig, OffboardingRequest, OnboardingRequest
|
||||
from workflows.models import FormCustomFieldConfig, FormCustomSectionConfig, FormFieldConfig, FormSectionConfig, OffboardingRequest, OnboardingRequest
|
||||
from workflows.pdf_sections import build_pdf_sections
|
||||
|
||||
|
||||
@@ -123,3 +123,38 @@ class PDFSectionBuilderTests(TestCase):
|
||||
|
||||
self.assertEqual(custom_field['label'], 'Bürostandort')
|
||||
self.assertEqual(custom_field['display_value'], 'Berlin Mitte')
|
||||
|
||||
def test_custom_section_title_is_used_in_pdf_sections(self):
|
||||
FormCustomSectionConfig.objects.create(
|
||||
form_type='onboarding',
|
||||
section_key='benefits',
|
||||
sort_order=10,
|
||||
title='Benefits',
|
||||
is_active=True,
|
||||
)
|
||||
FormCustomFieldConfig.objects.create(
|
||||
form_type='onboarding',
|
||||
field_key='meal_allowance',
|
||||
section_key='benefits',
|
||||
sort_order=0,
|
||||
field_type='text',
|
||||
is_active=True,
|
||||
label='Essenszuschuss',
|
||||
)
|
||||
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={'meal_allowance': 'Ja'},
|
||||
)
|
||||
|
||||
sections = build_pdf_sections('onboarding', request_obj, 'de')
|
||||
|
||||
custom_section = next(section for section in sections if section['key'] == 'benefits')
|
||||
self.assertEqual(custom_section['title'], 'Benefits')
|
||||
self.assertIn('custom__meal_allowance', [field['name'] for field in custom_section['fields']])
|
||||
|
||||
Reference in New Issue
Block a user