@@ -81,9 +81,7 @@ def test_bookplates_metadata_email(
81
81
mocker , mock_bookplate_metadata , mock_folio_variables
82
82
):
83
83
84
- mock_send_email = mocker .patch (
85
- "libsys_airflow.plugins.digital_bookplates.email.send_email_with_server_name" ,
86
- )
84
+ mock_send_email = mocker .patch ("libsys_airflow.plugins.shared.utils.send_email" )
87
85
88
86
bookplates_metadata_email .function (
89
87
new = mock_bookplate_metadata ["new" ], updated = mock_bookplate_metadata ["updated" ]
@@ -121,9 +119,7 @@ def test_bookplates_metadata_email(
121
119
122
120
123
121
def test_bookplates_metadata_email_none (mocker , mock_folio_variables , caplog ):
124
- mock_send_email = mocker .patch (
125
- "libsys_airflow.plugins.digital_bookplates.email.send_email_with_server_name"
126
- )
122
+ mock_send_email = mocker .patch ("libsys_airflow.plugins.shared.utils.send_email" )
127
123
128
124
bookplates_metadata_email .function (new = None , updated = None )
129
125
@@ -138,9 +134,7 @@ def test_no_new_bookplates_metadata_email(
138
134
mocker , mock_bookplate_metadata , mock_folio_variables , caplog
139
135
):
140
136
141
- mock_send_email = mocker .patch (
142
- "libsys_airflow.plugins.digital_bookplates.email.send_email_with_server_name"
143
- )
137
+ mock_send_email = mocker .patch ("libsys_airflow.plugins.shared.utils.send_email" )
144
138
145
139
bookplates_metadata_email .function (
146
140
new = [], updated = mock_bookplate_metadata ["updated" ]
@@ -173,9 +167,7 @@ def test_no_updated_bookplates_metadata_email(
173
167
mocker , mock_bookplate_metadata , mock_folio_variables , caplog
174
168
):
175
169
176
- mock_send_email = mocker .patch (
177
- "libsys_airflow.plugins.digital_bookplates.email.send_email_with_server_name"
178
- )
170
+ mock_send_email = mocker .patch ("libsys_airflow.plugins.shared.utils.send_email" )
179
171
180
172
bookplates_metadata_email .function (
181
173
new = mock_bookplate_metadata ["new" ],
@@ -201,9 +193,7 @@ def test_no_updated_bookplates_metadata_email(
201
193
202
194
def test_deleted_from_argo_email (mocker , mock_folio_variables ):
203
195
204
- mock_send_email = mocker .patch (
205
- "libsys_airflow.plugins.digital_bookplates.email.send_email_with_server_name"
206
- )
196
+ mock_send_email = mocker .patch ("libsys_airflow.plugins.shared.utils.send_email" )
207
197
208
198
deleted_druids_info = [
209
199
{"title" : "The Happy Fund" , "druid" : "ab123xy4567" , "fund_name" : "HAPY" }
@@ -226,9 +216,7 @@ def test_deleted_from_argo_email(mocker, mock_folio_variables):
226
216
227
217
228
218
def test_deleted_from_argo_email_no_druids (mocker , caplog ):
229
- mock_send_email = mocker .patch (
230
- "libsys_airflow.plugins.digital_bookplates.email.send_email_with_server_name"
231
- )
219
+ mock_send_email = mocker .patch ("libsys_airflow.plugins.shared.utils.send_email" )
232
220
233
221
deleted_from_argo_email .function (deleted_druids = [])
234
222
@@ -237,12 +225,10 @@ def test_deleted_from_argo_email_no_druids(mocker, caplog):
237
225
238
226
239
227
def test_deleted_from_argo_email_prod (mocker , mock_folio_variables , caplog ):
240
- mock_send_email = mocker .patch (
241
- "libsys_airflow.plugins.digital_bookplates.email.send_email_with_server_name"
242
- )
228
+ mock_send_email = mocker .patch ("libsys_airflow.plugins.shared.utils.send_email" )
243
229
244
230
mocker .patch (
245
- "libsys_airflow.plugins.digital_bookplates.email .is_production" ,
231
+ "libsys_airflow.plugins.shared.utils .is_production" ,
246
232
return_value = True ,
247
233
)
248
234
@@ -254,9 +240,7 @@ def test_deleted_from_argo_email_prod(mocker, mock_folio_variables, caplog):
254
240
255
241
256
242
def test_missing_fields_email (mocker , mock_folio_variables ):
257
- mock_send_email = mocker .patch (
258
- "libsys_airflow.plugins.digital_bookplates.email.send_email_with_server_name"
259
- )
243
+ mock_send_email = mocker .patch ("libsys_airflow.plugins.shared.utils.send_email" )
260
244
261
245
missing_fields_email .function (failures = failures )
262
246
@@ -284,12 +268,10 @@ def test_missing_fields_email_no_failures(mock_folio_variables, caplog):
284
268
285
269
286
270
def test_missing_fields_email_prod (mocker , mock_folio_variables ):
287
- mock_send_email = mocker .patch (
288
- "libsys_airflow.plugins.digital_bookplates.email.send_email_with_server_name"
289
- )
271
+ mock_send_email = mocker .patch ("libsys_airflow.plugins.shared.utils.send_email" )
290
272
291
273
mocker .patch (
292
- "libsys_airflow.plugins.digital_bookplates.email .is_production" ,
274
+ "libsys_airflow.plugins.shared.utils .is_production" ,
293
275
return_value = True ,
294
276
)
295
277
@@ -301,9 +283,7 @@ def test_missing_fields_email_prod(mocker, mock_folio_variables):
301
283
302
284
303
285
def test_summary_add_979_dag_runs (mocker , mock_folio_variables ):
304
- mock_send_email = mocker .patch (
305
- "libsys_airflow.plugins.digital_bookplates.email.send_email_with_server_name"
306
- )
286
+ mock_send_email = mocker .patch ("libsys_airflow.plugins.shared.utils.send_email" )
307
287
308
288
mocker .patch (
309
289
"libsys_airflow.plugins.digital_bookplates.email.conf.get" ,
@@ -357,8 +337,11 @@ def test_summary_add_979_dag_runs(mocker, mock_folio_variables):
357
337
358
338
359
339
def test_summary_add_979_dag_runs_prod (mocker , mock_folio_variables ):
360
- mock_send_email = mocker .patch (
361
- "libsys_airflow.plugins.digital_bookplates.email.send_email_with_server_name"
340
+ mock_send_email = mocker .patch ("libsys_airflow.plugins.shared.utils.send_email" )
341
+
342
+ mocker .patch (
343
+ "libsys_airflow.plugins.shared.utils.is_production" ,
344
+ return_value = True ,
362
345
)
363
346
364
347
mocker .patch (
@@ -374,6 +357,6 @@ def test_summary_add_979_dag_runs_prod(mocker, mock_folio_variables):
374
357
375
358
assert mock_send_email .call_args [1 ]["to" ] == [
376
359
377
-
378
360
361
+
379
362
]
0 commit comments