aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:19:37 -0700
committerSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:19:37 -0700
commit35fb123b995cbbe27d3edd5ed14abc6e56b7ad13 (patch)
treea8d061c933f9e65601e6290c10abd090b79fae26 /test
parent5f949ee35667a6065ab02a3e7ab8c98c9fcdcaed (diff)
downloadpython-urllib3-35fb123b995cbbe27d3edd5ed14abc6e56b7ad13.tar
python-urllib3-35fb123b995cbbe27d3edd5ed14abc6e56b7ad13.tar.gz
Imported Upstream version 1.8.2
Diffstat (limited to 'test')
-rw-r--r--test/test_poolmanager.py8
-rw-r--r--test/test_util.py6
2 files changed, 11 insertions, 3 deletions
diff --git a/test/test_poolmanager.py b/test/test_poolmanager.py
index 2faab94..759b5e3 100644
--- a/test/test_poolmanager.py
+++ b/test/test_poolmanager.py
@@ -2,7 +2,10 @@ import unittest
from urllib3.poolmanager import PoolManager
from urllib3 import connection_from_url
-from urllib3.exceptions import ClosedPoolError
+from urllib3.exceptions import (
+ ClosedPoolError,
+ LocationParseError,
+)
class TestPoolManager(unittest.TestCase):
@@ -63,6 +66,9 @@ class TestPoolManager(unittest.TestCase):
self.assertEqual(len(p.pools), 0)
+ def test_nohost(self):
+ p = PoolManager(5)
+ self.assertRaises(LocationParseError, p.connection_from_url, 'http://@')
if __name__ == '__main__':
diff --git a/test/test_util.py b/test/test_util.py
index ebd3b5f..5dcaeab 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -77,6 +77,7 @@ class TestUtil(unittest.TestCase):
for location in invalid_host:
self.assertRaises(LocationParseError, get_host, location)
+
def test_parse_url(self):
url_host_map = {
'http://google.com/mail': Url('http', host='google.com', path='/mail'),
@@ -107,6 +108,7 @@ class TestUtil(unittest.TestCase):
'http://foo:bar@localhost/': Url('http', auth='foo:bar', host='localhost', path='/'),
'http://foo@localhost/': Url('http', auth='foo', host='localhost', path='/'),
'http://foo:bar@baz@localhost/': Url('http', auth='foo:bar@baz', host='localhost', path='/'),
+ 'http://@': Url('http', host=None, auth='')
}
for url, expected_url in url_host_map.items():
returned_url = parse_url(url)
@@ -231,7 +233,7 @@ class TestUtil(unittest.TestCase):
self.assertTrue('int or float' in str(e))
- @patch('urllib3.util.current_time')
+ @patch('urllib3.util.timeout.current_time')
def test_timeout(self, current_time):
timeout = Timeout(total=3)
@@ -278,7 +280,7 @@ class TestUtil(unittest.TestCase):
self.assertEqual(str(timeout), "Timeout(connect=1, read=None, total=3)")
- @patch('urllib3.util.current_time')
+ @patch('urllib3.util.timeout.current_time')
def test_timeout_elapsed(self, current_time):
current_time.return_value = TIMEOUT_EPOCH
timeout = Timeout(total=3)