File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,3 +106,32 @@ def test_send_transactional_email_keeps_explicit_from_email(
106106 "from_email" : "no-reply" ,
107107 }
108108 send .assert_called_once_with (expected_payload )
109+
110+ @override_settings (
111+ ** DATAMAILER_SETTINGS ,
112+ DATAMAILER_FROM_EMAIL = "courses" ,
113+ DATAMAILER_TRANSACTIONAL_DRY_RUN = True ,
114+ )
115+ @patch (
116+ "course_management.datamailer.client_transactional.DatamailerTransactionalClient.send_transactional"
117+ )
118+ def test_send_transactional_email_adds_dry_run_when_configured (self , send ):
119+ # In a dry-run deployment (e2e) the prod send path runs unchanged; only
120+ # the dry_run flag is added so Datamailer renders without delivering.
121+ send .return_value = {"id" : "message-id" }
122+ payload = {
123+ "template_key" : "welcome" ,
124+ "email" : "student@example.com" ,
125+ }
126+
127+ send_transactional_email (payload )
128+
129+ expected_payload = {
130+ "audience" : "dtc-courses" ,
131+ "client" : "dtc-courses" ,
132+ "template_key" : "welcome" ,
133+ "email" : "student@example.com" ,
134+ "from_email" : "courses" ,
135+ "dry_run" : True ,
136+ }
137+ send .assert_called_once_with (expected_payload )
You can’t perform that action at this time.
0 commit comments