diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-05-16 19:40:01 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-05-16 19:40:01 (GMT) |
commit | de9ac6c2e5b5887e473a24f067942dcf306ed3d3 (patch) | |
tree | 4116086b6516d72bd6bc228dcb62e0258cb90c18 /Lib/test/test_urllib2_localnet.py | |
parent | 5d953184a6fae25bf27e769c90b419d9b2aa1af9 (diff) | |
download | cpython-de9ac6c2e5b5887e473a24f067942dcf306ed3d3.zip cpython-de9ac6c2e5b5887e473a24f067942dcf306ed3d3.tar.gz cpython-de9ac6c2e5b5887e473a24f067942dcf306ed3d3.tar.bz2 |
Issue #14780: urllib.request.urlopen() now has a `cadefault` argument to use the default certificate store.
Initial patch by James Oakley.
Diffstat (limited to 'Lib/test/test_urllib2_localnet.py')
-rw-r--r-- | Lib/test/test_urllib2_localnet.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py index 9e1ce5b..6ef4200 100644 --- a/Lib/test/test_urllib2_localnet.py +++ b/Lib/test/test_urllib2_localnet.py @@ -474,6 +474,13 @@ class TestUrlopen(unittest.TestCase): self.urlopen("https://localhost:%s/bizarre" % handler.port, cafile=CERT_fakehostname) + def test_https_with_cadefault(self): + handler = self.start_https_server(certfile=CERT_localhost) + # Self-signed cert should fail verification with system certificate store + with self.assertRaises(urllib.error.URLError) as cm: + self.urlopen("https://localhost:%s/bizarre" % handler.port, + cadefault=True) + def test_sending_headers(self): handler = self.start_server() req = urllib.request.Request("http://localhost:%s/" % handler.port, |