31
31
def fake_token (token ):
32
32
def fake_send (r , ** kwargs ):
33
33
resp = mock .MagicMock ()
34
+ resp .status_code = 200
34
35
resp .text = json .dumps (token )
35
36
return resp
36
37
@@ -70,6 +71,7 @@ def verifier(r, **kwargs):
70
71
auth_header = r .headers .get (str ("Authorization" ), None )
71
72
self .assertEqual (auth_header , token )
72
73
resp = mock .MagicMock ()
74
+ resp .status_code = 200
73
75
resp .cookes = []
74
76
return resp
75
77
@@ -89,6 +91,7 @@ def verifier(r, **kwargs):
89
91
self .assertEqual (cert , kwargs ["cert" ])
90
92
self .assertIn ("client_id=" + self .client_id , r .body )
91
93
resp = mock .MagicMock ()
94
+ resp .status_code = 200
92
95
resp .text = json .dumps (self .token )
93
96
return resp
94
97
@@ -134,6 +137,7 @@ def fake_refresh(r, **kwargs):
134
137
if "/refresh" in r .url :
135
138
self .assertNotIn ("Authorization" , r .headers )
136
139
resp = mock .MagicMock ()
140
+ resp .status_code = 200
137
141
resp .text = json .dumps (self .token )
138
142
return resp
139
143
@@ -177,6 +181,7 @@ def fake_refresh_with_auth(r, **kwargs):
177
181
content = "Basic {encoded}" .format (encoded = encoded .decode ("latin1" ))
178
182
self .assertEqual (r .headers ["Authorization" ], content )
179
183
resp = mock .MagicMock ()
184
+ resp .status_code = 200
180
185
resp .text = json .dumps (self .token )
181
186
return resp
182
187
@@ -263,6 +268,7 @@ def test_fetch_token(self):
263
268
def fake_token_history (token ):
264
269
def fake_send (r , ** kwargs ):
265
270
resp = mock .MagicMock ()
271
+ resp .status_code = 200
266
272
resp .text = json .dumps (token )
267
273
_fetch_history .append (
268
274
(r .url , r .body , r .headers .get ("Authorization" , None ))
@@ -470,6 +476,7 @@ def test_authorized_true(self):
470
476
def fake_token (token ):
471
477
def fake_send (r , ** kwargs ):
472
478
resp = mock .MagicMock ()
479
+ resp .status_code = 200
473
480
resp .text = json .dumps (token )
474
481
return resp
475
482
0 commit comments