@@ -31,7 +31,10 @@ def setUp(self):
31
31
32
32
def test_user_refresh (self ):
33
33
with self .client :
34
- refresh_header = get_test_request_header (user1 ["username" ], refresh = True )
34
+ refresh_header = get_test_request_header (
35
+ {"id" : self .first_user .id , "password" : self .first_user .password_hash },
36
+ refresh = True ,
37
+ )
35
38
response = self .client .post (
36
39
"/refresh" ,
37
40
headers = refresh_header ,
@@ -83,6 +86,22 @@ def test_user_refresh_expired_token(self):
83
86
self .assertEqual (401 , actual_response .status_code )
84
87
self .assertEqual (expected_response , json .loads (actual_response .data ))
85
88
89
+ def test_user_refresh_reset_password (self ):
90
+ refresh_header = get_test_request_header (
91
+ {"id" : self .first_user .id , "password" : "new_password_hash" },
92
+ refresh = True ,
93
+ )
94
+ expected_response = messages .TOKEN_IS_INVALID
95
+ actual_response = self .client .post (
96
+ "/refresh" ,
97
+ follow_redirects = True ,
98
+ headers = refresh_header ,
99
+ content_type = "application/json" ,
100
+ )
101
+
102
+ self .assertEqual (401 , actual_response .status_code )
103
+ self .assertEqual (expected_response , json .loads (actual_response .data ))
104
+
86
105
87
106
if __name__ == "__main__" :
88
107
unittest .main ()
0 commit comments