snapshot: preserve dynamic form builder parity and presets
This commit is contained in:
@@ -4,7 +4,7 @@ from django.contrib.auth import get_user_model
|
||||
from django.test import TestCase
|
||||
|
||||
from workflows.branding import get_company_email_domain
|
||||
from workflows.models import FormFieldConfig, OnboardingRequest
|
||||
from workflows.models import FormFieldConfig, FormSectionConfig, OnboardingRequest
|
||||
|
||||
|
||||
class OnboardingFlowTests(TestCase):
|
||||
@@ -112,3 +112,34 @@ class OnboardingFlowTests(TestCase):
|
||||
self.assertContains(response, 'Dieses Feld ist zwingend erforderlich.')
|
||||
self.assertFalse(OnboardingRequest.objects.filter(work_email=f'lina.leer@{self.company_domain}').exists())
|
||||
mock_delay.assert_not_called()
|
||||
|
||||
@patch('workflows.views.process_onboarding_request.delay')
|
||||
def test_hidden_itsetup_section_is_removed_from_form_and_submission(self, mock_delay):
|
||||
FormSectionConfig.objects.update_or_create(
|
||||
form_type='onboarding',
|
||||
section_key='itsetup',
|
||||
defaults={'is_visible': False},
|
||||
)
|
||||
|
||||
response = self.client.get('/onboarding/new/', HTTP_HOST='localhost')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertNotContains(response, '3. IT-Setup')
|
||||
|
||||
payload = {
|
||||
'first_name': 'Nora',
|
||||
'last_name': 'Neutral',
|
||||
'gender': 'frau',
|
||||
'job_title': 'Consultant',
|
||||
'department': 'IT-Service',
|
||||
'work_email': f'nora.section@{self.company_domain}',
|
||||
'contract_start': '2026-11-01',
|
||||
'employment_type': 'unbefristet',
|
||||
'group_mailboxes_required_choice': 'nein',
|
||||
'agreement_confirm': 'on',
|
||||
}
|
||||
|
||||
submit_response = self.client.post('/onboarding/new/', payload, HTTP_HOST='localhost')
|
||||
|
||||
self.assertEqual(submit_response.status_code, 302)
|
||||
self.assertTrue(OnboardingRequest.objects.filter(work_email=f'nora.section@{self.company_domain}').exists())
|
||||
mock_delay.assert_called_once()
|
||||
|
||||
Reference in New Issue
Block a user