15
15
from openforms .emails .tests .factories import ConfirmationEmailTemplateFactory
16
16
from openforms .forms .constants import LogicActionTypes , PropertyTypes
17
17
from openforms .forms .tests .factories import FormLogicFactory
18
+ from openforms .logging .models import TimelineLogProxy
18
19
from openforms .payments .constants import PaymentStatus
19
20
from openforms .payments .tests .factories import SubmissionPaymentFactory
20
21
from openforms .registrations .base import PreRegistrationResult
21
22
from openforms .registrations .contrib .zgw_apis .tests .factories import (
22
23
ZGWApiGroupConfigFactory ,
23
24
)
25
+ from openforms .tests .utils import log_flaky
24
26
from openforms .utils .tests .logging import ensure_logger_level
25
27
26
28
from ..constants import PostSubmissionEvents , RegistrationStatuses
@@ -893,8 +895,24 @@ def test_cosign_not_required_and_not_filled_in_proceeds_with_registration(self):
893
895
mock_payment_status_update .assert_not_called ()
894
896
895
897
mails = mail .outbox
898
+ submission .refresh_from_db ()
899
+
900
+ # FLAKINESS HERE happens something, try to figure out what's going wrong
901
+ if not mails :
902
+ log_flaky ()
903
+
904
+ # try to detect why no registration email was sent
905
+ print (f"{ submission .registration_status = } " )
906
+ print (f"{ submission .payment_required = } " )
907
+ print (f"{ submission .confirmation_email_sent = } " )
908
+ print (f"{ submission .form .send_confirmation_email = } " )
909
+ # and print logevents
910
+ logs = TimelineLogProxy .objects .for_object (submission )
911
+ for log in logs :
912
+ print (log .message ().strip ())
913
+
914
+ self .assertEqual (len (mails ), 1 ) # No cosign request email!
896
915
897
- self .assertEqual (1 , len (mails )) # No cosign request email!
898
916
self .assertEqual (
899
917
mails [0 ].subject , "Confirmation of your Pretty Form submission"
900
918
)
@@ -905,8 +923,6 @@ def test_cosign_not_required_and_not_filled_in_proceeds_with_registration(self):
905
923
906
924
self .assertNotIn (cosign_info , mails [0 ].body .strip ("\n " ))
907
925
908
- submission .refresh_from_db ()
909
-
910
926
self .assertFalse (submission .cosign_request_email_sent )
911
927
self .assertTrue (submission .confirmation_email_sent )
912
928
self .assertNotEqual (submission .auth_info .value , "111222333" )
0 commit comments