1+ from notifications .models import EmailTemplateIdentifier
2+ from notifications .tests .factories import EmailTemplateFactory
13from privacy_policy .models import PrivacyPolicyAcceptanceRecord
24from files_upload .tests .factories import FileFactory
35from conferences .tests .factories import (
@@ -138,7 +140,11 @@ def _submit_proposal(client, conference, submission, **kwargs):
138140 )
139141
140142
141- def test_submit_talk (graphql_client , user , django_capture_on_commit_callbacks , mocker ):
143+ def test_submit_talk (
144+ graphql_client , user , django_capture_on_commit_callbacks , mocker , settings
145+ ):
146+ settings .FRONTEND_URL = "http://testserver"
147+ mock_email_template = mocker .patch ("api.submissions.mutations.EmailTemplate" )
142148 mock_notify = mocker .patch ("api.submissions.mutations.notify_new_cfp_submission" )
143149 graphql_client .force_login (user )
144150
@@ -151,6 +157,11 @@ def test_submit_talk(graphql_client, user, django_capture_on_commit_callbacks, m
151157 audience_levels = ("Beginner" ,),
152158 )
153159
160+ EmailTemplateFactory (
161+ conference = conference ,
162+ identifier = EmailTemplateIdentifier .proposal_received_confirmation ,
163+ )
164+
154165 speaker_photo = FileFactory ().id
155166
156167 with django_capture_on_commit_callbacks (execute = True ):
@@ -208,6 +219,15 @@ def test_submit_talk(graphql_client, user, django_capture_on_commit_callbacks, m
208219
209220 mock_notify .delay .assert_called_once ()
210221
222+ mock_email_template .objects .for_conference ().get_by_identifier ().send_email .assert_called_once_with (
223+ recipient = user ,
224+ placeholders = {
225+ "user_name" : user .full_name ,
226+ "proposal_title" : "English" ,
227+ "proposal_url" : f"http://testserver/submission/{ talk .hashid } " ,
228+ },
229+ )
230+
211231
212232def test_submit_talk_with_photo_to_upload (graphql_client , user , mocker ):
213233 graphql_client .force_login (user )
@@ -220,7 +240,10 @@ def test_submit_talk_with_photo_to_upload(graphql_client, user, mocker):
220240 durations = ("50" ,),
221241 audience_levels = ("Beginner" ,),
222242 )
223-
243+ EmailTemplateFactory (
244+ conference = conference ,
245+ identifier = EmailTemplateIdentifier .proposal_received_confirmation ,
246+ )
224247 speaker_photo = FileFactory ().id
225248
226249 resp , variables = _submit_talk (
@@ -253,6 +276,11 @@ def test_submit_talk_without_photo_fails(graphql_client, user, mocker):
253276 audience_levels = ("Beginner" ,),
254277 )
255278
279+ EmailTemplateFactory (
280+ conference = conference ,
281+ identifier = EmailTemplateIdentifier .proposal_received_confirmation ,
282+ )
283+
256284 resp , variables = _submit_talk (
257285 graphql_client ,
258286 conference ,
@@ -282,6 +310,11 @@ def test_submit_talk_with_existing_participant(graphql_client, user):
282310 audience_levels = ("Beginner" ,),
283311 )
284312
313+ EmailTemplateFactory (
314+ conference = conference ,
315+ identifier = EmailTemplateIdentifier .proposal_received_confirmation ,
316+ )
317+
285318 participant = Participant .objects .create (
286319 conference = conference , user_id = user .id , bio = "old bio"
287320 )
@@ -339,6 +372,11 @@ def test_submit_talk_with_missing_data_of_other_language_fails(graphql_client, u
339372 audience_levels = ("Beginner" ,),
340373 )
341374
375+ EmailTemplateFactory (
376+ conference = conference ,
377+ identifier = EmailTemplateIdentifier .proposal_received_confirmation ,
378+ )
379+
342380 resp , _ = _submit_talk (
343381 graphql_client ,
344382 conference ,
@@ -370,6 +408,11 @@ def test_submit_talk_with_missing_data_fails(graphql_client, user):
370408 audience_levels = ("Beginner" ,),
371409 )
372410
411+ EmailTemplateFactory (
412+ conference = conference ,
413+ identifier = EmailTemplateIdentifier .proposal_received_confirmation ,
414+ )
415+
373416 resp , _ = _submit_talk (
374417 graphql_client ,
375418 conference ,
@@ -413,6 +456,11 @@ def test_submit_talk_with_multiple_languages(graphql_client, user):
413456 audience_levels = ("Beginner" ,),
414457 )
415458
459+ EmailTemplateFactory (
460+ conference = conference ,
461+ identifier = EmailTemplateIdentifier .proposal_received_confirmation ,
462+ )
463+
416464 resp , variables = _submit_talk (
417465 graphql_client ,
418466 conference ,
0 commit comments