@@ -120,7 +120,7 @@ def test_it_sends_emails(
120
120
reply ,
121
121
mention ,
122
122
emails ,
123
- mailer ,
123
+ email ,
124
124
asdict ,
125
125
):
126
126
asdict .return_value = sentinel .email_data
@@ -151,32 +151,32 @@ def test_it_sends_emails(
151
151
notification_service .allow_notifications .assert_called_once_with (
152
152
annotation , notification .parent_user
153
153
)
154
- email = emails .reply_notification .generate .return_value
155
- asdict .assert_called_once_with (email )
154
+ email_data = emails .reply_notification .generate .return_value
155
+ asdict .assert_called_once_with (email_data )
156
156
157
- mailer .send .delay .assert_called_once_with (asdict .return_value )
157
+ email .send .delay .assert_called_once_with (asdict .return_value )
158
158
159
159
notification_service .save_notification .assert_called_once_with (
160
160
annotation = annotation ,
161
161
recipient = notification .parent_user ,
162
162
notification_type = NotificationType .REPLY ,
163
163
)
164
164
165
- def test_it_does_nothing_if_no_notification_is_required (self , event , reply , mailer ):
165
+ def test_it_does_nothing_if_no_notification_is_required (self , event , reply , email ):
166
166
reply .get_notification .return_value = None
167
167
168
168
subscribers .send_reply_notifications (event )
169
169
170
- mailer .send .delay .assert_not_called ()
170
+ email .send .delay .assert_not_called ()
171
171
172
- def test_it_fails_gracefully_if_the_task_does_not_queue (self , event , mailer ):
173
- mailer .send .side_effect = OperationalError
172
+ def test_it_fails_gracefully_if_the_task_does_not_queue (self , event , email ):
173
+ email .send .side_effect = OperationalError
174
174
175
175
# No explosions please
176
176
subscribers .send_reply_notifications (event )
177
177
178
178
def test_it_does_nothing_if_the_reply_user_is_mentioned (
179
- self , event , reply , mailer , mention
179
+ self , event , reply , email , mention
180
180
):
181
181
reply_notification = mock .MagicMock ()
182
182
reply .get_notification .return_value = reply_notification
@@ -187,16 +187,16 @@ def test_it_does_nothing_if_the_reply_user_is_mentioned(
187
187
188
188
subscribers .send_reply_notifications (event )
189
189
190
- mailer .send .delay .assert_not_called ()
190
+ email .send .delay .assert_not_called ()
191
191
192
192
def test_it_does_nothing_if_notifications_arent_allowed (
193
- self , event , mailer , notification_service
193
+ self , event , email , notification_service
194
194
):
195
195
notification_service .allow_notifications .return_value = False
196
196
197
197
subscribers .send_reply_notifications (event )
198
198
199
- mailer .send .delay .assert_not_called ()
199
+ email .send .delay .assert_not_called ()
200
200
201
201
@pytest .fixture
202
202
def event (self , pyramid_request ):
@@ -218,7 +218,7 @@ def test_it_sends_emails(
218
218
notification_service ,
219
219
mention ,
220
220
emails ,
221
- mailer ,
221
+ email ,
222
222
asdict ,
223
223
):
224
224
notifications = mention .get_notifications .return_value
@@ -244,9 +244,9 @@ def test_it_sends_emails(
244
244
notification_service .allow_notifications .assert_called_once_with (
245
245
annotation , notifications [0 ].mentioned_user
246
246
)
247
- email = emails .mention_notification .generate .return_value
248
- asdict .assert_called_once_with (email )
249
- mailer .send .delay .assert_called_once_with (asdict .return_value )
247
+ email_data = emails .mention_notification .generate .return_value
248
+ asdict .assert_called_once_with (email_data )
249
+ email .send .delay .assert_called_once_with (asdict .return_value )
250
250
251
251
notification_service .save_notification .assert_called_once_with (
252
252
annotation = annotation ,
@@ -255,28 +255,28 @@ def test_it_sends_emails(
255
255
)
256
256
257
257
def test_it_does_nothing_if_no_notification_is_required (
258
- self , event , mention , mailer
258
+ self , event , mention , email
259
259
):
260
260
mention .get_notifications .return_value = []
261
261
262
262
subscribers .send_mention_notifications (event )
263
263
264
- mailer .send .delay .assert_not_called ()
264
+ email .send .delay .assert_not_called ()
265
265
266
- def test_it_fails_gracefully_if_the_task_does_not_queue (self , event , mailer ):
267
- mailer .send .side_effect = OperationalError
266
+ def test_it_fails_gracefully_if_the_task_does_not_queue (self , event , email ):
267
+ email .send .side_effect = OperationalError
268
268
269
269
# No explosions please
270
270
subscribers .send_mention_notifications (event )
271
271
272
272
def test_it_does_nothing_if_notifications_arent_allowed (
273
- self , event , mailer , notification_service
273
+ self , event , email , notification_service
274
274
):
275
275
notification_service .allow_notifications .return_value = False
276
276
277
277
subscribers .send_mention_notifications (event )
278
278
279
- mailer .send .delay .assert_not_called ()
279
+ email .send .delay .assert_not_called ()
280
280
281
281
@pytest .fixture
282
282
def event (self , pyramid_request ):
@@ -321,8 +321,8 @@ def mention(patch):
321
321
322
322
323
323
@pytest .fixture (autouse = True )
324
- def mailer (patch ):
325
- return patch ("h.subscribers.mailer " )
324
+ def email (patch ):
325
+ return patch ("h.subscribers.email " )
326
326
327
327
328
328
@pytest .fixture (autouse = True )
0 commit comments