diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2016-05-13 01:35:29 -0700 |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2016-05-13 01:35:29 -0700 |
commit | 5d1110a952ee9551b249bcd4dd1f3d3bc21371b8 (patch) | |
tree | 185bc1479f27f930ec0ba53637928186dd9499ff /Lib/test | |
parent | f94ec1bd832831186e309afbec60ac1ed0200564 (diff) | |
parent | 9642eedc0a6d90d9502658a6569518741eea9ef3 (diff) | |
download | cpython-git-5d1110a952ee9551b249bcd4dd1f3d3bc21371b8.tar.gz |
merge from 3.5
Issue #26892: Honor debuglevel flag in urllib.request.HTTPHandler.
Patch contributed by Chi Hsuan Yen.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_urllib2.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index df8a891645..8716a5e78c 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -480,8 +480,8 @@ class MockHTTPSHandler(urllib.request.AbstractHTTPHandler): # Useful for testing the Proxy-Authorization request by verifying the # properties of httpcon - def __init__(self): - urllib.request.AbstractHTTPHandler.__init__(self) + def __init__(self, debuglevel=0): + urllib.request.AbstractHTTPHandler.__init__(self, debuglevel=debuglevel) self.httpconn = MockHTTPClass() def https_open(self, req): @@ -950,6 +950,13 @@ class HandlerTests(unittest.TestCase): newreq = h.do_request_(req) self.assertEqual(int(newreq.get_header('Content-length')),16) + def test_http_handler_debuglevel(self): + o = OpenerDirector() + h = MockHTTPSHandler(debuglevel=1) + o.add_handler(h) + o.open("https://www.example.com") + self.assertEqual(h._debuglevel, 1) + def test_http_doubleslash(self): # Checks the presence of any unnecessary double slash in url does not # break anything. Previously, a double slash directly after the host |