-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 [#3901] Fix submissions incorrectly expecting cosigning
When cosign components are (dynamically) hidden, this effectively makes the form/submission *not* a cosign form. However, due to logic not being taken into account, the mere presence of a required cosign component would block the registration by waiting for cosign.
- Loading branch information
1 parent
48b6d3b
commit 3bd0286
Showing
2 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,8 @@ | |
from openforms.authentication.service import AuthAttribute | ||
from openforms.config.models import GlobalConfiguration | ||
from openforms.emails.tests.factories import ConfirmationEmailTemplateFactory | ||
from openforms.forms.tests.factories import FormDefinitionFactory | ||
from openforms.forms.constants import LogicActionTypes, PropertyTypes | ||
from openforms.forms.tests.factories import FormDefinitionFactory, FormLogicFactory | ||
from openforms.payments.constants import PaymentStatus | ||
from openforms.payments.tests.factories import SubmissionPaymentFactory | ||
from openforms.registrations.base import PreRegistrationResult | ||
|
@@ -1027,6 +1028,56 @@ def test_cosign_required_but_hidden_proceeds_with_registration(self): | |
submission.refresh_from_db() | ||
self.assertEqual(submission.registration_status, RegistrationStatuses.success) | ||
|
||
@tag("gh-3901", "hlmr-86") | ||
def test_cosign_required_and_visible_via_logic_does_not_proceed_with_registration( | ||
self, | ||
): | ||
""" | ||
A conditionally displayed cosign component must 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": ["[email protected]"]}, | ||
auth_info__attribute=AuthAttribute.bsn, | ||
auth_info__value="111222333", | ||
language_code="en", | ||
) | ||
FormLogicFactory.create( | ||
form=submission.form, | ||
json_logic_trigger=True, | ||
actions=[ | ||
{ | ||
"action": { | ||
"type": LogicActionTypes.property, | ||
"property": { | ||
"type": PropertyTypes.bool, | ||
"value": "hidden", | ||
}, | ||
"state": False, | ||
}, | ||
"component": "cosign", | ||
} | ||
], | ||
) | ||
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.pending) | ||
|
||
@tag("gh-3924") | ||
def test_payment_complete_does_not_set_retry_flag(self): | ||
submission = SubmissionFactory.create( | ||
|