Skip to content
Myr

changed behavior of basic-http-auth test

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 e15280e · Browse files · 1 file+2 added−24 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+2 added−24 removed

  • tests:+2 added−24 removed

1 file+2 added−24 removed

modified:tests/test_requests.py+2 added-24 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, bytes)21 builtin_str, OrderedDict)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 471 if isinstance(username, bytes):472 httpbin_username = username.decode('latin1')473 else:474 httpbin_username = username470 url = httpbin('get')471476 if isinstance(password, bytes):477 httpbin_password = password.decode('latin1')478 else:479 httpbin_password = password480481 url = httpbin('basic-auth', httpbin_username, httpbin_password)482472 r = requests.Request('GET', url, auth=auth)473 p = r.prepare()474475 assert p.headers['Authorization'] == _basic_auth_str(username, password)487 488 r = requests.get(url, auth=auth)489 assert r.status_code == 200476491 r = requests.get(url)492 assert r.status_code == 401493494 s = requests.session()495 s.auth = auth496 r = s.get(url)497 assert r.status_code == 200498477 @pytest.mark.parametrize(478 'url, exception', (479 # Connecting to an unknown domain should raise a ConnectionError480 ('http://doesnotexist.google.com', ConnectionError),
1659 unmodified lines