@@ -173,10 +173,10 @@ def _get_canvas_properties(
173
173
@patch ("common.djangoapps.student.tasks.get_owners_for_course" )
174
174
@patch ("common.djangoapps.student.tasks.get_course_run_details" )
175
175
@patch ("common.djangoapps.student.tasks.get_course_dates_for_email" )
176
- @patch ("common.djangoapps.student.tasks.get_braze_client " )
176
+ @patch ("common.djangoapps.student.tasks.get_email_client " )
177
177
def test_success_calls_for_canvas_properties (
178
178
self ,
179
- mock_get_braze_client ,
179
+ mock_get_email_client ,
180
180
mock_get_course_dates_for_email ,
181
181
mock_get_course_run_details ,
182
182
mock_get_owners_for_course ,
@@ -194,7 +194,7 @@ def test_success_calls_for_canvas_properties(
194
194
send_course_enrollment_email .apply_async (
195
195
kwargs = self .send_course_enrollment_email_kwargs
196
196
)
197
- mock_get_braze_client .return_value .send_canvas_message .assert_called_with (
197
+ mock_get_email_client .return_value .send_canvas_message .assert_called_with (
198
198
canvas_id = BRAZE_COURSE_ENROLLMENT_CANVAS_ID ,
199
199
recipients = [
200
200
{
@@ -207,14 +207,14 @@ def test_success_calls_for_canvas_properties(
207
207
@patch ("common.djangoapps.student.tasks.get_course_uuid_for_course" )
208
208
@patch ("common.djangoapps.student.tasks.get_owners_for_course" )
209
209
@patch ("common.djangoapps.student.tasks.get_course_run_details" )
210
- @patch ("common.djangoapps.student.tasks.get_braze_client " )
210
+ @patch ("common.djangoapps.student.tasks.get_email_client " )
211
211
@patch (
212
212
"common.djangoapps.student.tasks.get_course_dates_for_email" ,
213
213
Mock (side_effect = Exception ),
214
214
)
215
215
def test_canvas_properties_without_course_dates (
216
216
self ,
217
- mock_get_braze_client ,
217
+ mock_get_email_client ,
218
218
mock_get_course_run_details ,
219
219
mock_get_owners_for_course ,
220
220
mock_get_course_uuid_for_course ,
@@ -230,7 +230,7 @@ def test_canvas_properties_without_course_dates(
230
230
send_course_enrollment_email .apply_async (
231
231
kwargs = self .send_course_enrollment_email_kwargs
232
232
)
233
- mock_get_braze_client .return_value .send_canvas_message .assert_called_with (
233
+ mock_get_email_client .return_value .send_canvas_message .assert_called_with (
234
234
canvas_id = BRAZE_COURSE_ENROLLMENT_CANVAS_ID ,
235
235
recipients = [
236
236
{
@@ -243,14 +243,14 @@ def test_canvas_properties_without_course_dates(
243
243
@patch ("common.djangoapps.student.tasks.get_course_uuid_for_course" )
244
244
@patch ("common.djangoapps.student.tasks.get_owners_for_course" )
245
245
@patch ("common.djangoapps.student.tasks.get_course_dates_for_email" )
246
- @patch ("common.djangoapps.student.tasks.get_braze_client " )
246
+ @patch ("common.djangoapps.student.tasks.get_email_client " )
247
247
@patch (
248
248
"common.djangoapps.student.tasks.get_course_run_details" ,
249
249
Mock (side_effect = Exception ),
250
250
)
251
251
def test_canvas_properties_on_get_course_run_details_failure (
252
252
self ,
253
- mock_get_braze_client ,
253
+ mock_get_email_client ,
254
254
mock_get_course_dates_for_email ,
255
255
mock_get_owners_for_course ,
256
256
mock_get_course_uuid_for_course ,
@@ -266,7 +266,7 @@ def test_canvas_properties_on_get_course_run_details_failure(
266
266
send_course_enrollment_email .apply_async (
267
267
kwargs = self .send_course_enrollment_email_kwargs
268
268
)
269
- mock_get_braze_client .return_value .send_canvas_message .assert_called_with (
269
+ mock_get_email_client .return_value .send_canvas_message .assert_called_with (
270
270
canvas_id = BRAZE_COURSE_ENROLLMENT_CANVAS_ID ,
271
271
recipients = [
272
272
{
@@ -280,12 +280,12 @@ def test_canvas_properties_on_get_course_run_details_failure(
280
280
281
281
@patch ("common.djangoapps.student.tasks.get_course_uuid_for_course" )
282
282
@patch ("common.djangoapps.student.tasks.get_course_dates_for_email" )
283
- @patch ("common.djangoapps.student.tasks.get_braze_client " )
283
+ @patch ("common.djangoapps.student.tasks.get_email_client " )
284
284
@patch (TASK_LOGGER )
285
285
def test_email_task_when_course_uuid_is_missing (
286
286
self ,
287
287
mocked_logger ,
288
- mock_get_braze_client ,
288
+ mock_get_email_client ,
289
289
mock_get_course_dates_for_email ,
290
290
mock_get_course_uuid_for_course ,
291
291
):
@@ -304,7 +304,7 @@ def test_email_task_when_course_uuid_is_missing(
304
304
f"[Course Enrollment] Course run call failed for "
305
305
f"user: { self .user .id } course: { self .course .id } error: Missing course_uuid"
306
306
)
307
- mock_get_braze_client .return_value .send_canvas_message .assert_called_with (
307
+ mock_get_email_client .return_value .send_canvas_message .assert_called_with (
308
308
canvas_id = BRAZE_COURSE_ENROLLMENT_CANVAS_ID ,
309
309
recipients = [
310
310
{
@@ -318,12 +318,12 @@ def test_email_task_when_course_uuid_is_missing(
318
318
@patch ("common.djangoapps.student.tasks.get_owners_for_course" )
319
319
@patch ("common.djangoapps.student.tasks.get_course_run_details" )
320
320
@patch ("common.djangoapps.student.tasks.get_course_dates_for_email" )
321
- @patch ("common.djangoapps.student.tasks.get_braze_client " )
321
+ @patch ("common.djangoapps.student.tasks.get_email_client " )
322
322
@patch (TASK_LOGGER )
323
323
def test_email_task_when_course_run_is_missing (
324
324
self ,
325
325
mocked_logger ,
326
- mock_get_braze_client ,
326
+ mock_get_email_client ,
327
327
mock_get_course_dates_for_email ,
328
328
mock_get_course_run_details ,
329
329
mock_get_owners_for_course ,
@@ -346,7 +346,7 @@ def test_email_task_when_course_run_is_missing(
346
346
f"[Course Enrollment] Course run call failed for "
347
347
f"user: { self .user .id } course: { self .course .id } error: Missing course_run"
348
348
)
349
- mock_get_braze_client .return_value .send_canvas_message .assert_called_with (
349
+ mock_get_email_client .return_value .send_canvas_message .assert_called_with (
350
350
canvas_id = BRAZE_COURSE_ENROLLMENT_CANVAS_ID ,
351
351
recipients = [
352
352
{
@@ -360,7 +360,7 @@ def test_email_task_when_course_run_is_missing(
360
360
@patch ("common.djangoapps.student.tasks.get_owners_for_course" )
361
361
@patch ("common.djangoapps.student.tasks.get_course_run_details" )
362
362
@patch ("common.djangoapps.student.tasks.get_course_dates_for_email" )
363
- def test_retry_with_braze_client_exception (
363
+ def test_retry_with_email_client_exception (
364
364
self ,
365
365
mock_get_course_dates_for_email ,
366
366
mock_get_course_run_details ,
@@ -377,12 +377,12 @@ def test_retry_with_braze_client_exception(
377
377
mock_get_course_dates_for_email .return_value = self ._get_course_dates ()
378
378
379
379
with patch (
380
- 'common.djangoapps.student.tasks.get_braze_client ' ,
380
+ 'common.djangoapps.student.tasks.get_email_client ' ,
381
381
new_callable = PropertyMock ,
382
382
side_effect = Exception ('Braze Client Exception' )
383
- ) as mock_get_braze_client :
383
+ ) as mock_get_email_client :
384
384
task = send_course_enrollment_email .apply_async (
385
385
kwargs = self .send_course_enrollment_email_kwargs
386
386
)
387
387
pytest .raises (Exception , task .get )
388
- self .assertEqual (mock_get_braze_client .call_count , (MAX_RETRIES + 1 ))
388
+ self .assertEqual (mock_get_email_client .call_count , (MAX_RETRIES + 1 ))
0 commit comments