-
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.
🐛 [#4022] Handle serialized args to celery task
Backport-of: #4023
- Loading branch information
1 parent
0528605
commit cf93c5a
Showing
2 changed files
with
28 additions
and
2 deletions.
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
""" | ||
Test the registration hook on submissions. | ||
""" | ||
|
||
from datetime import timedelta | ||
from unittest.mock import patch | ||
|
||
|
@@ -17,6 +18,7 @@ | |
from openforms.forms.models import FormRegistrationBackend | ||
from openforms.logging.models import TimelineLogProxy | ||
from openforms.submissions.constants import PostSubmissionEvents, RegistrationStatuses | ||
from openforms.submissions.public_references import get_random_reference | ||
from openforms.submissions.tests.factories import SubmissionFactory | ||
|
||
from ..base import BasePlugin | ||
|
@@ -345,6 +347,27 @@ def test_registration_backend_invalid_options(self): | |
): | ||
register_submission(submission.id, PostSubmissionEvents.on_retry) | ||
|
||
def test_calling_registration_task_with_serialized_args(self): | ||
submission = SubmissionFactory.create( | ||
completed=True, | ||
public_registration_reference=get_random_reference(), | ||
with_completed_payment=True, | ||
form__registration_backend="email", | ||
form__registration_backend_options={"to_emails": ["[email protected]"]}, | ||
) | ||
|
||
with patch( | ||
"openforms.registrations.tasks.GlobalConfiguration.get_solo", | ||
return_value=GlobalConfiguration(wait_for_payment_to_register=True), | ||
): | ||
register_submission( | ||
submission.id, str(PostSubmissionEvents.on_payment_complete) | ||
) | ||
|
||
submission.refresh_from_db() | ||
|
||
self.assertEqual(submission.registration_status, RegistrationStatuses.success) | ||
|
||
|
||
class NumRegistrationsTest(TestCase): | ||
@patch("openforms.plugins.registry.GlobalConfiguration.get_solo") | ||
|