Skip to content

Commit

Permalink
🎨 [#4650] Revert generic test changes
Browse files Browse the repository at this point in the history
The test module is aimed at the generic registration mechanism and
just 'happens' to use the email plugin. We do not need to repeat all
the various cases/failure modes that are already covered by the
plugin unit tests.
  • Loading branch information
sergei-maertens committed Dec 30, 2024
1 parent b234978 commit 2f06255
Showing 1 changed file with 1 addition and 43 deletions.
44 changes: 1 addition & 43 deletions src/openforms/registrations/tests/test_registration_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def test_registration_backend_invalid_options(self):
completed=True,
form__registration_backend="email",
form__registration_backend_options={},
) # Missing "to_emails" and "to_emails_from_variable" option
) # Missing "to_emails" option

with (
self.subTest("On completion - does NOT raise"),
Expand All @@ -334,48 +334,6 @@ def test_registration_backend_invalid_options(self):
):
register_submission(submission.id, PostSubmissionEvents.on_retry)

def test_email_registration_backend_with_to_emails(self):
submission = SubmissionFactory.create(
completed=True,
form__registration_backend="email",
form__registration_backend_options={"to_emails": ["[email protected]"]},
)

with (
self.subTest("On completion - logs as successful"),
self.assertLogs(level="INFO") as logs,
):
register_submission(submission.id, PostSubmissionEvents.on_completion)

submission.refresh_from_db()
self.assertIn(
"Registration using plugin '%r' for submission '%s' succeeded",
logs.records[-1].msg,
)
self.assertFalse(submission.needs_on_completion_retry)

def test_email_registration_backend_with_to_emails_from_variable(self):
submission = SubmissionFactory.create(
completed=True,
form__registration_backend="email",
form__registration_backend_options={
"to_emails_from_variable": "email_example_variable"
},
)

with (
self.subTest("On completion - logs as successful"),
self.assertLogs(level="INFO") as logs,
):
register_submission(submission.id, PostSubmissionEvents.on_completion)

submission.refresh_from_db()
self.assertIn(
"Registration using plugin '%r' for submission '%s' succeeded",
logs.records[-1].msg,
)
self.assertFalse(submission.needs_on_completion_retry)

def test_calling_registration_task_with_serialized_args(self):
submission = SubmissionFactory.create(
completed=True,
Expand Down

0 comments on commit 2f06255

Please sign in to comment.