3131def fake_token (token ):
3232 def fake_send (r , ** kwargs ):
3333 resp = mock .MagicMock ()
34+ resp .status_code = 200
3435 resp .text = json .dumps (token )
3536 return resp
3637
@@ -70,6 +71,7 @@ def verifier(r, **kwargs):
7071 auth_header = r .headers .get (str ("Authorization" ), None )
7172 self .assertEqual (auth_header , token )
7273 resp = mock .MagicMock ()
74+ resp .status_code = 200
7375 resp .cookes = []
7476 return resp
7577
@@ -89,6 +91,7 @@ def verifier(r, **kwargs):
8991 self .assertEqual (cert , kwargs ["cert" ])
9092 self .assertIn ("client_id=" + self .client_id , r .body )
9193 resp = mock .MagicMock ()
94+ resp .status_code = 200
9295 resp .text = json .dumps (self .token )
9396 return resp
9497
@@ -134,6 +137,7 @@ def fake_refresh(r, **kwargs):
134137 if "/refresh" in r .url :
135138 self .assertNotIn ("Authorization" , r .headers )
136139 resp = mock .MagicMock ()
140+ resp .status_code = 200
137141 resp .text = json .dumps (self .token )
138142 return resp
139143
@@ -177,6 +181,7 @@ def fake_refresh_with_auth(r, **kwargs):
177181 content = "Basic {encoded}" .format (encoded = encoded .decode ("latin1" ))
178182 self .assertEqual (r .headers ["Authorization" ], content )
179183 resp = mock .MagicMock ()
184+ resp .status_code = 200
180185 resp .text = json .dumps (self .token )
181186 return resp
182187
@@ -263,6 +268,7 @@ def test_fetch_token(self):
263268 def fake_token_history (token ):
264269 def fake_send (r , ** kwargs ):
265270 resp = mock .MagicMock ()
271+ resp .status_code = 200
266272 resp .text = json .dumps (token )
267273 _fetch_history .append (
268274 (r .url , r .body , r .headers .get ("Authorization" , None ))
@@ -470,6 +476,7 @@ def test_authorized_true(self):
470476 def fake_token (token ):
471477 def fake_send (r , ** kwargs ):
472478 resp = mock .MagicMock ()
479+ resp .status_code = 200
473480 resp .text = json .dumps (token )
474481 return resp
475482
0 commit comments