Skip to content
Myr

digestauth: threadsafe test

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

authored by Pierre Tardy · committed by exvito · parent e8d9bc5 · Browse files · 1 file+20 added−0 removed
This commit

State

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

Trailers

  • Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>

Diff stats

1 file+20 added−0 removed

  • other:+20 added−0 removed

1 file+20 added−0 removed

modified:test_requests.py+20 added
30 unmodified lines
31 import StringIO32except ImportError:33 import io as StringIO3435try:36 from multiprocessing.pool import ThreadPool37except ImportError:38 ThreadPool = None3940if is_py3:41 def u(s):42 return s43else:
371 unmodified lines
415416 r = requests.get(url, auth=auth)417 assert '"auth"' in r.request.headers['Authorization']418419 def test_DIGESTAUTH_THREADED(self):420421 auth = HTTPDigestAuth('user', 'pass')422 url = httpbin('digest-auth', 'auth', 'user', 'pass')423 session = requests.Session()424 session.auth=auth425426 def do_request(i):427 r = session.get(url)428 assert '"auth"' in r.request.headers['Authorization']429 return 1430 if ThreadPool is not None:431 pool = ThreadPool(processes=50)432 pool.map(do_request, range(100))433434 def test_POSTBIN_GET_POST_FILES(self):435436 url = httpbin('post')437 post1 = requests.post(url).raise_for_status()
1222 unmodified lines