Skip to content

Commit 15289a0

Browse files
committed
fix mail mocking issues for password reset
1 parent 519b710 commit 15289a0

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

api_tests/users/views/sanction_response/test_user_sanction_response.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ def test_post_missing_fields(self, app, sanction_url, user):
5151
auth=user.auth,
5252
expect_errors=True
5353
)
54-
print(res.json)
5554
assert res.json['errors'] == [
5655
{
5756
'source': {

api_tests/users/views/test_user_settings.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
AuthUserFactory,
1010
UserFactory,
1111
)
12+
from website import settings
1213
from django.middleware import csrf
1314
from osf.models import Email, NotableDomain
1415
from framework.auth.views import auth_email_logout
@@ -92,7 +93,7 @@ class TestUserChangePassword:
9293
@pytest.fixture()
9394
def user_one(self):
9495
user = UserFactory()
95-
user.set_password('password1')
96+
user.set_password('password1', notify=False)
9697
user.auth = (user.username, 'password1')
9798
user.save()
9899
return user
@@ -128,7 +129,8 @@ def test_post(self, app, user_one, user_two, url, payload):
128129
assert res.status_code == 403
129130

130131
# Logged in
131-
res = app.post_json_api(url, payload, auth=user_one.auth)
132+
with mock.patch.object(settings, 'USE_EMAIL', False):
133+
res = app.post_json_api(url, payload, auth=user_one.auth)
132134
assert res.status_code == 204
133135
user_one.reload()
134136
assert user_one.check_password('password2')

0 commit comments

Comments
 (0)