Skip to content

Commit

Permalink
added testcases to check email send once
Browse files Browse the repository at this point in the history
  • Loading branch information
bodintsov authored and John Tordoff committed Jan 15, 2025
1 parent d007d63 commit 3c93931
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion admin/base/settings/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
CSRF_COOKIE_HTTPONLY = False

ALLOWED_HOSTS = [
'.osf.io'
'.osf.io',
'localhost',
'127.0.0.1'
]

AUTH_PASSWORD_VALIDATORS = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ def test_institutional_admin_unauth_institution(self, app, project, institution_
assert res.status_code == 403
assert 'Institutional request access is not enabled.' in res.json['errors'][0]['detail']

@mock.patch('website.mails.send_mail')
def test_email_send_to_all_admins_once_on_institutional_request(self, mock_mail, app, project, url, create_payload, institutional_admin):
project.is_public = True
project.save()
res = app.post_json_api(url, create_payload, auth=institutional_admin.auth)
assert res.status_code == 201
assert mock_mail.call_count == 1

@mock.patch('api.requests.serializers.send_mail')
def test_email_not_sent_without_recipient(self, mock_mail, app, project, institutional_admin, url,
create_payload, institution):
Expand Down
1 change: 1 addition & 0 deletions osf/features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ flags:
- flag_name: INSTITUTIONAL_DASHBOARD_2024
name: institutional_dashboard_2024
note: whether to surface older or updated (in 2024) institutional metrics
everyone: false

switches:
- flag_name: DISABLE_ENGAGEMENT_EMAILS
Expand Down

0 comments on commit 3c93931

Please sign in to comment.