Skip to content
Myr

fixed: httpbin with unicode auth

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

authored by Dmitry Klimenko · committed by Dmitry Klimenko · parent 55dea23 · Browse files · 1 file+13 added−2 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+13 added−2 removed

  • tests:+13 added−2 removed

1 file+13 added−2 removed

modified:tests/test_requests.py+13 added-2 removed
16 unmodified lines
17from requests.adapters import HTTPAdapter18from requests.auth import HTTPDigestAuth, _basic_auth_str19from requests.compat import (20 Morsel, cookielib, getproxies, str, urlparse,21 builtin_str, OrderedDict)21 builtin_str, OrderedDict, bytes)22from requests.cookies import (23 cookiejar_from_dict, morsel_to_cookie, merge_cookies)24from requests.exceptions import (25 ConnectionError, ConnectTimeout, InvalidSchema, InvalidURL,
440 unmodified lines
466 (u'имя'.encode('utf-8'), u'пароль'.encode('utf-8')),467 ))468 def test_BASICAUTH_TUPLE_HTTP_200_OK_GET(self, httpbin, username, password):469 auth = (username, password)470 url = httpbin('get')470 471 if isinstance(username, bytes):472 httpbin_username = username.decode('latin1')473 else:474 httpbin_username = username475476 if isinstance(password, bytes):477 httpbin_password = password.decode('latin1')478 else:479 httpbin_password = password480481 url = httpbin('basic-auth', httpbin_username, httpbin_password)482483 r = requests.Request('GET', url, auth=auth)484 p = r.prepare()485486 assert p.headers['Authorization'] == _basic_auth_str(username, password)
1675 unmodified lines