mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Merge pull request #3383 from davidsoncasey/proposed/3.0.0
Change exception and variable names so that tests will run.
This commit is contained in:
@@ -33,14 +33,14 @@ from .packages.urllib3.exceptions import SSLError as _SSLError
|
||||
from .packages.urllib3.exceptions import ResponseError
|
||||
from .cookies import extract_cookies_to_jar
|
||||
from .exceptions import (ConnectionError, ConnectTimeout, ReadTimeout, SSLError,
|
||||
ProxyError, RetryError, InvalidSchema)
|
||||
ProxyError, RetryError, InvalidScheme)
|
||||
from .auth import _basic_auth_str
|
||||
|
||||
try:
|
||||
from .packages.urllib3.contrib.socks import SOCKSProxyManager
|
||||
except ImportError:
|
||||
def SOCKSProxyManager(*args, **kwargs):
|
||||
raise InvalidSchema("Missing dependencies for SOCKS support.")
|
||||
raise InvalidScheme("Missing dependencies for SOCKS support.")
|
||||
|
||||
DEFAULT_POOLBLOCK = False
|
||||
DEFAULT_POOLSIZE = 10
|
||||
|
||||
@@ -152,7 +152,7 @@ class SessionRedirectMixin(object):
|
||||
if response.is_permanent_redirect and request.url != prepared_request.url:
|
||||
self.redirect_cache[request.url] = prepared_request.url
|
||||
|
||||
self.rebuild_method(prepared_request, resp)
|
||||
self.rebuild_method(prepared_request, response)
|
||||
|
||||
# https://github.com/kennethreitz/requests/issues/1084
|
||||
if response.status_code not in (codes.temporary_redirect, codes.permanent_redirect):
|
||||
|
||||
@@ -20,8 +20,8 @@ from requests.compat import (
|
||||
builtin_str, OrderedDict)
|
||||
from requests.cookies import cookiejar_from_dict, morsel_to_cookie
|
||||
from requests.exceptions import (
|
||||
ConnectionError, ConnectTimeout, InvalidSchema, InvalidURL,
|
||||
MissingSchema, ReadTimeout, Timeout, RetryError, TooManyRedirects,
|
||||
ConnectionError, ConnectTimeout, InvalidScheme, InvalidURL,
|
||||
MissingScheme, ReadTimeout, Timeout, RetryError, TooManyRedirects,
|
||||
ProxyError)
|
||||
from requests.models import PreparedRequest
|
||||
from requests.structures import CaseInsensitiveDict
|
||||
@@ -67,10 +67,10 @@ class TestRequests:
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'exception, url', (
|
||||
(MissingSchema, 'hiwpefhipowhefopw'),
|
||||
(InvalidSchema, 'localhost:3128'),
|
||||
(InvalidSchema, 'localhost.localdomain:3128/'),
|
||||
(InvalidSchema, '10.122.1.1:3128/'),
|
||||
(MissingScheme, 'hiwpefhipowhefopw'),
|
||||
(InvalidScheme, 'localhost:3128'),
|
||||
(InvalidScheme, 'localhost.localdomain:3128/'),
|
||||
(InvalidScheme, '10.122.1.1:3128/'),
|
||||
(InvalidURL, 'http://'),
|
||||
))
|
||||
def test_invalid_url(self, exception, url):
|
||||
|
||||
Reference in New Issue
Block a user