Skip to content
Myr

Make sure we unapply this patch.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Cory Benfield · committed by Cory Benfield · parent f52287d · Browse files · 1 file+22 added−17 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+22 added−17 removed

  • other:+22 added−17 removed

1 file+22 added−17 removed

modified:test_requests.py+22 added-17 removed
351 unmodified lines
352 auth = ('user', 'pass')353 wrong_auth = ('wronguser', 'wrongpass')354 url = httpbin('basic-auth', 'user', 'pass')355356 def get_netrc_auth_mock(url):357 return auth358 requests.sessions.get_netrc_auth = get_netrc_auth_mock356 old_auth = requests.sessions.get_netrc_auth357360 # Should use netrc and work.361 r = requests.get(url)362 assert r.status_code == 200358 try:359 def get_netrc_auth_mock(url):360 return auth361 requests.sessions.get_netrc_auth = get_netrc_auth_mock362364 # Given auth should override and fail.365 r = requests.get(url, auth=wrong_auth)366 assert r.status_code == 401363 # Should use netrc and work.364 r = requests.get(url)365 assert r.status_code == 200366368 s = requests.session()367 # Given auth should override and fail.368 r = requests.get(url, auth=wrong_auth)369 assert r.status_code == 401370370 # Should use netrc and work.371 r = s.get(url)372 assert r.status_code == 200371 s = requests.session()372374 # Given auth should override and fail.375 s.auth = wrong_auth376 r = s.get(url)377 assert r.status_code == 401373 # Should use netrc and work.374 r = s.get(url)375 assert r.status_code == 200376377 # Given auth should override and fail.378 s.auth = wrong_auth379 r = s.get(url)380 assert r.status_code == 401381 finally:382 requests.sessions.get_netrc_auth = old_auth383384 def test_DIGEST_HTTP_200_OK_GET(self):385386 auth = HTTPDigestAuth('user', 'pass')387 url = httpbin('digest-auth', 'auth', 'user', 'pass')
1360 unmodified lines