aboutsummaryrefslogtreecommitdiff
path: root/test/with_dummyserver/test_proxy_poolmanager.py
diff options
context:
space:
mode:
authorSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:19:41 -0700
committerSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:19:41 -0700
commitb6ab7bae87b22c6fae783e8850533219d3bf8a29 (patch)
tree472a760e2e976ea3e9545e09584392accee9cd6d /test/with_dummyserver/test_proxy_poolmanager.py
parent54bdd56778a37ea9d56d451d4ae49b99cbbfceaa (diff)
downloadpython-urllib3-b6ab7bae87b22c6fae783e8850533219d3bf8a29.tar
python-urllib3-b6ab7bae87b22c6fae783e8850533219d3bf8a29.tar.gz
Imported Upstream version 1.10
Diffstat (limited to 'test/with_dummyserver/test_proxy_poolmanager.py')
-rw-r--r--test/with_dummyserver/test_proxy_poolmanager.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/test/with_dummyserver/test_proxy_poolmanager.py b/test/with_dummyserver/test_proxy_poolmanager.py
index 61eedf1..df300fe 100644
--- a/test/with_dummyserver/test_proxy_poolmanager.py
+++ b/test/with_dummyserver/test_proxy_poolmanager.py
@@ -1,13 +1,17 @@
-import unittest
import json
import socket
+import unittest
+
+from nose.tools import timed
from dummyserver.testcase import HTTPDummyProxyTestCase
from dummyserver.server import (
DEFAULT_CA, DEFAULT_CA_BAD, get_unreachable_address)
+from .. import TARPIT_HOST
from urllib3.poolmanager import proxy_from_url, ProxyManager
-from urllib3.exceptions import MaxRetryError, SSLError, ProxyError
+from urllib3.exceptions import (
+ MaxRetryError, SSLError, ProxyError, ConnectTimeoutError)
from urllib3.connectionpool import connection_from_url, VerifiedHTTPSConnection
@@ -259,5 +263,25 @@ class TestHTTPProxyManager(HTTPDummyProxyTestCase):
self.assertEqual(sc3,sc4)
+ @timed(0.5)
+ def test_https_proxy_timeout(self):
+ https = proxy_from_url('https://{host}'.format(host=TARPIT_HOST))
+ try:
+ https.request('GET', self.http_url, timeout=0.001)
+ self.fail("Failed to raise retry error.")
+ except MaxRetryError as e:
+ assert isinstance(e.reason, ConnectTimeoutError)
+
+
+ @timed(0.5)
+ def test_https_proxy_pool_timeout(self):
+ https = proxy_from_url('https://{host}'.format(host=TARPIT_HOST),
+ timeout=0.001)
+ try:
+ https.request('GET', self.http_url)
+ self.fail("Failed to raise retry error.")
+ except MaxRetryError as e:
+ assert isinstance(e.reason, ConnectTimeoutError)
+
if __name__ == '__main__':
unittest.main()