diff --git a/src/openforms/config/tests/factories.py b/src/openforms/config/tests/factories.py index 08476e714b..745819c796 100644 --- a/src/openforms/config/tests/factories.py +++ b/src/openforms/config/tests/factories.py @@ -17,7 +17,7 @@ class Meta: class MapTileLayerFactory(factory.django.DjangoModelFactory): - identifier = factory.Faker("word") + identifier = factory.Sequence(lambda n: f"map-tile-layer-{n}") url = factory.Sequence(lambda n: f"http://example-{n}.com") label = factory.Faker("word") diff --git a/src/openforms/submissions/tests/test_post_submission_event.py b/src/openforms/submissions/tests/test_post_submission_event.py index e4a975d28b..739c9a0712 100644 --- a/src/openforms/submissions/tests/test_post_submission_event.py +++ b/src/openforms/submissions/tests/test_post_submission_event.py @@ -15,12 +15,14 @@ from openforms.emails.tests.factories import ConfirmationEmailTemplateFactory from openforms.forms.constants import LogicActionTypes, PropertyTypes from openforms.forms.tests.factories import FormLogicFactory +from openforms.logging.models import TimelineLogProxy from openforms.payments.constants import PaymentStatus from openforms.payments.tests.factories import SubmissionPaymentFactory from openforms.registrations.base import PreRegistrationResult from openforms.registrations.contrib.zgw_apis.tests.factories import ( ZGWApiGroupConfigFactory, ) +from openforms.tests.utils import log_flaky from openforms.utils.tests.logging import ensure_logger_level from ..constants import PostSubmissionEvents, RegistrationStatuses @@ -893,8 +895,24 @@ def test_cosign_not_required_and_not_filled_in_proceeds_with_registration(self): mock_payment_status_update.assert_not_called() mails = mail.outbox + submission.refresh_from_db() + + # FLAKINESS HERE happens something, try to figure out what's going wrong + if not mails: + log_flaky() + + # try to detect why no registration email was sent + print(f"{submission.registration_status=}") + print(f"{submission.payment_required=}") + print(f"{submission.confirmation_email_sent=}") + print(f"{submission.form.send_confirmation_email=}") + # and print logevents + logs = TimelineLogProxy.objects.for_object(submission) + for log in logs: + print(log.message().strip()) + + self.assertEqual(len(mails), 1) # No cosign request email! - self.assertEqual(1, len(mails)) # No cosign request email! self.assertEqual( mails[0].subject, "Confirmation of your Pretty Form submission" ) @@ -905,8 +923,6 @@ def test_cosign_not_required_and_not_filled_in_proceeds_with_registration(self): self.assertNotIn(cosign_info, mails[0].body.strip("\n")) - submission.refresh_from_db() - self.assertFalse(submission.cosign_request_email_sent) self.assertTrue(submission.confirmation_email_sent) self.assertNotEqual(submission.auth_info.value, "111222333")