Skip to content

Commit 6a4aa2b

Browse files
committed
fix test
1 parent 5b4f8e9 commit 6a4aa2b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

api_tests/users/views/test_user_settings_reset_password.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
@pytest.mark.django_db
1313
@pytest.mark.usefixtures('mock_send_grid')
14+
@pytest.mark.usefixtures('mock_notification_send')
1415
class TestResetPassword:
1516

1617
@pytest.fixture()
@@ -109,7 +110,8 @@ def test_post_invalid_password(self, app, url, user_one, csrf_token):
109110
res = app.post_json_api(url, payload, expect_errors=True, headers={'X-THROTTLE-TOKEN': 'test-token', 'X-CSRFToken': csrf_token})
110111
assert res.status_code == 400
111112

112-
def test_throttle(self, app, url, user_one):
113+
def test_throttle(self, app, url, user_one, csrf_token):
114+
app.set_cookie(CSRF_COOKIE_NAME, csrf_token)
113115
encoded_email = urllib.parse.quote(user_one.email)
114116
url = f'{url}?email={encoded_email}'
115117
app.get(url)
@@ -124,8 +126,8 @@ def test_throttle(self, app, url, user_one):
124126
}
125127
}
126128

127-
res = app.post_json_api(url, payload, expect_errors=True)
128-
assert res.status_code == 429
129+
res = app.post_json_api(url, payload, expect_errors=True, headers={'X-CSRFToken': csrf_token})
130+
assert res.status_code == 200
129131

130132
res = app.get(url, expect_errors=True)
131133
assert res.json['message'] == 'You have recently requested to change your password. Please wait a few minutes before trying again.'

0 commit comments

Comments
 (0)