summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib2.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_urllib2.py')
-rw-r--r--Lib/test/test_urllib2.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index 7d41ea1..36d7e87 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -1422,6 +1422,21 @@ class HandlerTests(unittest.TestCase):
handler.do_open(conn, req)
self.assertTrue(conn.fakesock.closed, "Connection not closed")
+ def test_auth_prior_handler(self):
+ pwd_manager = MockPasswordManager()
+ pwd_manager.add_password(None, 'https://example.com',
+ 'somebody', 'verysecret')
+ auth_prior_handler = urllib.request.HTTPBasicPriorAuthHandler(
+ pwd_manager)
+ http_hand = MockHTTPSHandler()
+
+ opener = OpenerDirector()
+ opener.add_handler(http_hand)
+ opener.add_handler(auth_prior_handler)
+
+ req = Request("https://example.com")
+ opener.open(req)
+ self.assertNotIn('Authorization', http_hand.httpconn.req_headers)
class MiscTests(unittest.TestCase):