summaryrefslogtreecommitdiff
path: root/tests/test_requests.py
diff options
context:
space:
mode:
authorDmitry Klimenko <github.com@klimenko.net>2016-11-18 20:39:55 +0300
committerDmitry Klimenko <github.com@klimenko.net>2016-11-18 20:39:55 +0300
commit3b84be3c99edf49c4770882b83726b98751ec1c3 (patch)
treeac8f9178c1abc6b1e60b5da2dc2e87cd22eebf22 /tests/test_requests.py
parente15280e49d9ee15bd7b5f3a00862d5f0a720b8e1 (diff)
downloadpython-requests-3b84be3c99edf49c4770882b83726b98751ec1c3.tar.gz
changed behavior of basic-http-auth test
Diffstat (limited to 'tests/test_requests.py')
-rwxr-xr-xtests/test_requests.py26
1 files changed, 2 insertions, 24 deletions
diff --git a/tests/test_requests.py b/tests/test_requests.py
index 69c9d972..64cc773f 100755
--- a/tests/test_requests.py
+++ b/tests/test_requests.py
@@ -18,7 +18,7 @@ from requests.adapters import HTTPAdapter
from requests.auth import HTTPDigestAuth, _basic_auth_str
from requests.compat import (
Morsel, cookielib, getproxies, str, urlparse,
- builtin_str, OrderedDict, bytes)
+ builtin_str, OrderedDict)
from requests.cookies import (
cookiejar_from_dict, morsel_to_cookie, merge_cookies)
from requests.exceptions import (
@@ -467,34 +467,12 @@ class TestRequests:
))
def test_BASICAUTH_TUPLE_HTTP_200_OK_GET(self, httpbin, username, password):
auth = (username, password)
-
- if isinstance(username, bytes):
- httpbin_username = username.decode('latin1')
- else:
- httpbin_username = username
-
- if isinstance(password, bytes):
- httpbin_password = password.decode('latin1')
- else:
- httpbin_password = password
-
- url = httpbin('basic-auth', httpbin_username, httpbin_password)
+ url = httpbin('get')
r = requests.Request('GET', url, auth=auth)
p = r.prepare()
assert p.headers['Authorization'] == _basic_auth_str(username, password)
-
- r = requests.get(url, auth=auth)
- assert r.status_code == 200
-
- r = requests.get(url)
- assert r.status_code == 401
-
- s = requests.session()
- s.auth = auth
- r = s.get(url)
- assert r.status_code == 200
@pytest.mark.parametrize(
'url, exception', (