11
11
12
12
@pytest .mark .django_db
13
13
@pytest .mark .usefixtures ('mock_send_grid' )
14
+ @pytest .mark .usefixtures ('mock_notification_send' )
14
15
class TestResetPassword :
15
16
16
17
@pytest .fixture ()
@@ -109,7 +110,8 @@ def test_post_invalid_password(self, app, url, user_one, csrf_token):
109
110
res = app .post_json_api (url , payload , expect_errors = True , headers = {'X-THROTTLE-TOKEN' : 'test-token' , 'X-CSRFToken' : csrf_token })
110
111
assert res .status_code == 400
111
112
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 )
113
115
encoded_email = urllib .parse .quote (user_one .email )
114
116
url = f'{ url } ?email={ encoded_email } '
115
117
app .get (url )
@@ -124,8 +126,8 @@ def test_throttle(self, app, url, user_one):
124
126
}
125
127
}
126
128
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
129
131
130
132
res = app .get (url , expect_errors = True )
131
133
assert res .json ['message' ] == 'You have recently requested to change your password. Please wait a few minutes before trying again.'
0 commit comments