From 48b6d3bd45080f32abfc6347adb8e569e0d2d030 Mon Sep 17 00:00:00 2001 From: Sergei Maertens Date: Fri, 6 Dec 2024 14:26:17 +0100 Subject: [PATCH] :test_tube: [#3901] Add regression test for blocked registration because of cosign A required but hidden cosign component should not block the submission registration. --- .../tests/test_post_submission_event.py | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/openforms/submissions/tests/test_post_submission_event.py b/src/openforms/submissions/tests/test_post_submission_event.py index bcbc50d8ad..e388fcf870 100644 --- a/src/openforms/submissions/tests/test_post_submission_event.py +++ b/src/openforms/submissions/tests/test_post_submission_event.py @@ -24,7 +24,7 @@ ) from openforms.utils.tests.logging import ensure_logger_level -from ..constants import PostSubmissionEvents +from ..constants import PostSubmissionEvents, RegistrationStatuses from ..models import SubmissionReport from ..tasks import on_post_submission_event from .factories import SubmissionFactory @@ -996,6 +996,37 @@ def test_cosign_not_required_but_filled_in_does_not_proceed_with_registration(se self.assertTrue(submission.confirmation_email_sent) self.assertEqual(submission.auth_info.value, "111222333") + @tag("gh-3901", "hlmr-86") + def test_cosign_required_but_hidden_proceeds_with_registration(self): + """ + A conditionally hidden cosign component may not block registration. + """ + submission = SubmissionFactory.from_components( + components_list=[ + { + "key": "cosign", + "type": "cosign", + "label": "Cosign component", + "validate": {"required": True}, + "hidden": True, + }, + ], + submitted_data={"cosign": ""}, + completed=True, + cosign_complete=False, + form__registration_backend="email", + form__registration_backend_options={"to_emails": ["test@registration.nl"]}, + auth_info__attribute=AuthAttribute.bsn, + auth_info__value="111222333", + language_code="en", + ) + assert submission.registration_status == RegistrationStatuses.pending + + on_post_submission_event(submission.pk, PostSubmissionEvents.on_completion) + + submission.refresh_from_db() + self.assertEqual(submission.registration_status, RegistrationStatuses.success) + @tag("gh-3924") def test_payment_complete_does_not_set_retry_flag(self): submission = SubmissionFactory.create(