@@ -27,6 +27,7 @@ def user():
2727
2828@pytest .mark .django_db
2929@pytest .mark .enable_implicit_clean
30+ @pytest .mark .usefixtures ('mock_notification_send' )
3031class NodeCRUDTestCase :
3132
3233 @pytest .fixture ()
@@ -1202,15 +1203,14 @@ def test_add_contributor_validation(
12021203@pytest .mark .django_db
12031204@pytest .mark .enable_bookmark_creation
12041205@pytest .mark .enable_enqueue_task
1205- @pytest .mark .usefixtures ('mock_send_grid' )
12061206class TestNodeContributorCreateEmail (NodeCRUDTestCase ):
12071207
12081208 @pytest .fixture ()
12091209 def url_project_contribs (self , project_public ):
12101210 return f'/{ API_BASE } nodes/{ project_public ._id } /contributors/'
12111211
12121212 def test_add_contributor_no_email_if_false (
1213- self , mock_send_grid , app , user , url_project_contribs
1213+ self , mock_notification_send , app , user , url_project_contribs
12141214 ):
12151215 url = f'{ url_project_contribs } ?send_email=false'
12161216 payload = {
@@ -1221,10 +1221,10 @@ def test_add_contributor_no_email_if_false(
12211221 }
12221222 res = app .post_json_api (url , payload , auth = user .auth )
12231223 assert res .status_code == 201
1224- assert mock_send_grid .call_count == 0
1224+ assert mock_notification_send .call_count == 0
12251225
12261226 def test_add_contributor_sends_email (
1227- self , mock_send_grid , app , user , user_two , url_project_contribs
1227+ self , mock_notification_send , app , user , user_two , url_project_contribs
12281228 ):
12291229 url = f'{ url_project_contribs } ?send_email=default'
12301230 payload = {
@@ -1239,7 +1239,6 @@ def test_add_contributor_sends_email(
12391239
12401240 res = app .post_json_api (url , payload , auth = user .auth )
12411241 assert res .status_code == 201
1242- assert mock_send_grid .call_count == 1
12431242
12441243 @mock .patch ('website.project.signals.contributor_added.send' )
12451244 def test_add_contributor_signal_if_default (
@@ -1281,7 +1280,7 @@ def test_add_contributor_signal_preprint_email_disallowed(
12811280 )
12821281
12831282 def test_add_unregistered_contributor_sends_email (
1284- self , mock_send_grid , app , user , url_project_contribs
1283+ self , mock_notification_send , app , user , url_project_contribs
12851284 ):
12861285 url = f'{ url_project_contribs } ?send_email=default'
12871286 payload = {
@@ -1292,7 +1291,7 @@ def test_add_unregistered_contributor_sends_email(
12921291 }
12931292 res = app .post_json_api (url , payload , auth = user .auth )
12941293 assert res .status_code == 201
1295- assert mock_send_grid .call_count == 1
1294+ assert mock_notification_send .call_count == 1
12961295
12971296 @mock .patch ('website.project.signals.unreg_contributor_added.send' )
12981297 def test_add_unregistered_contributor_signal_if_default (
@@ -1328,7 +1327,7 @@ def test_add_unregistered_contributor_signal_preprint_email_disallowed(
13281327 )
13291328
13301329 def test_add_contributor_invalid_send_email_param (
1331- self , mock_send_grid , app , user , url_project_contribs
1330+ self , mock_notification_send , app , user , url_project_contribs
13321331 ):
13331332 url = f'{ url_project_contribs } ?send_email=true'
13341333 payload = {
@@ -1342,10 +1341,10 @@ def test_add_contributor_invalid_send_email_param(
13421341 assert (
13431342 res .json ['errors' ][0 ]['detail' ] == 'true is not a valid email preference.'
13441343 )
1345- assert mock_send_grid .call_count == 0
1344+ assert mock_notification_send .call_count == 0
13461345
13471346 def test_add_unregistered_contributor_without_email_no_email (
1348- self , mock_send_grid , app , user , url_project_contribs
1347+ self , mock_notification_send , app , user , url_project_contribs
13491348 ):
13501349 url = f'{ url_project_contribs } ?send_email=default'
13511350 payload = {
@@ -1361,7 +1360,7 @@ def test_add_unregistered_contributor_without_email_no_email(
13611360 res = app .post_json_api (url , payload , auth = user .auth )
13621361 assert contributor_added in mock_signal .signals_sent ()
13631362 assert res .status_code == 201
1364- assert mock_send_grid .call_count == 0
1363+ assert mock_notification_send .call_count == 0
13651364
13661365
13671366@pytest .mark .django_db
0 commit comments