@@ -183,30 +183,30 @@ def test_pkce_uniqueness(self):
183183
184184def test_scope_uses_first_bearer_challenge_when_multiple_are_present ():
185185 """RFC 6750 fields come from the first Bearer challenge, not another scheme or later challenge."""
186- response = httpx .Response (
186+ response = httpx2 .Response (
187187 401 ,
188188 headers = {
189189 "WWW-Authenticate" : (
190190 'Basic scope="legacy", Bearer scope="read", error="insufficient_scope", Bearer scope="write"'
191191 )
192192 },
193- request = httpx .Request ("GET" , "https://example.com" ),
193+ request = httpx2 .Request ("GET" , "https://example.com" ),
194194 )
195195
196196 assert extract_scope_from_www_auth (response ) == "read"
197197
198198
199199def test_bearer_fields_support_optional_whitespace_around_equals ():
200200 """Bearer auth-params allow optional whitespace around the equals sign."""
201- response = httpx .Response (
201+ response = httpx2 .Response (
202202 401 ,
203203 headers = {
204204 "WWW-Authenticate" : (
205205 'Bearer error="insufficient_scope", scope = "read write", '
206206 'resource_metadata = "https://example.com/.well-known/oauth-protected-resource"'
207207 )
208208 },
209- request = httpx .Request ("GET" , "https://example.com" ),
209+ request = httpx2 .Request ("GET" , "https://example.com" ),
210210 )
211211
212212 assert extract_scope_from_www_auth (response ) == "read write"
@@ -217,10 +217,10 @@ def test_bearer_fields_support_optional_whitespace_around_equals():
217217
218218def test_generic_field_lookup_preserves_non_bearer_challenges ():
219219 """The generic helper keeps its pre-existing ability to read fields from other auth schemes."""
220- response = httpx .Response (
220+ response = httpx2 .Response (
221221 401 ,
222222 headers = {"WWW-Authenticate" : 'Newauth realm="apps"' },
223- request = httpx .Request ("GET" , "https://example.com" ),
223+ request = httpx2 .Request ("GET" , "https://example.com" ),
224224 )
225225
226226 assert extract_field_from_www_auth (response , "realm" ) == "apps"
@@ -229,15 +229,15 @@ def test_generic_field_lookup_preserves_non_bearer_challenges():
229229
230230def test_quoted_auth_params_handle_escaped_quotes_and_commas ():
231231 """RFC quoted-pairs do not terminate a quoted value or split its embedded comma."""
232- response = httpx .Response (
232+ response = httpx2 .Response (
233233 401 ,
234234 headers = {
235235 "WWW-Authenticate" : (
236236 'Newauth realm="apps \\ "beta\\ ", east", '
237237 'Bearer error_description="try \\ "again\\ ", later", scope="read write"'
238238 )
239239 },
240- request = httpx .Request ("GET" , "https://example.com" ),
240+ request = httpx2 .Request ("GET" , "https://example.com" ),
241241 )
242242
243243 assert extract_field_from_www_auth (response , "realm" ) == 'apps "beta", east'
@@ -246,21 +246,21 @@ def test_quoted_auth_params_handle_escaped_quotes_and_commas():
246246
247247def test_bearer_parser_ignores_empty_segments_and_stops_at_next_challenge ():
248248 """The first Bearer challenge ends when another authentication scheme begins."""
249- response = httpx .Response (
249+ response = httpx2 .Response (
250250 401 ,
251251 headers = {"WWW-Authenticate" : ', Bearer scope="read", Basic realm="legacy",' },
252- request = httpx .Request ("GET" , "https://example.com" ),
252+ request = httpx2 .Request ("GET" , "https://example.com" ),
253253 )
254254
255255 assert extract_scope_from_www_auth (response ) == "read"
256256
257257
258258def test_empty_quoted_auth_param_returns_none ():
259259 """An empty quoted auth-param has the same missing-value result as an unquoted empty parameter."""
260- response = httpx .Response (
260+ response = httpx2 .Response (
261261 401 ,
262262 headers = {"WWW-Authenticate" : 'Bearer scope=""' },
263- request = httpx .Request ("GET" , "https://example.com" ),
263+ request = httpx2 .Request ("GET" , "https://example.com" ),
264264 )
265265
266266 assert extract_scope_from_www_auth (response ) is None
0 commit comments