Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(651)

Unified Diff: Lib/test/test_urllib2_localnet.py

Issue 14780: urllib.request could use the default CA store
Patch Set: Created 1 year ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Doc/library/urllib.request.rst ('k') | Lib/urllib/request.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_urllib2_localnet.py Fri May 11 13:11:02 2012 -0400
+++ b/Lib/test/test_urllib2_localnet.py Wed May 16 12:11:57 2012 -0700
@@ -454,7 +454,7 @@
def test_https(self):
handler = self.start_https_server()
- data = self.urlopen("https://localhost:%s/bizarre" % handler.port)
+ data = self.urlopen("https://localhost:%s/bizarre" % handler.port, cadefault=False)
self.assertEqual(data, b"we care a bit")
def test_https_with_cafile(self):
@@ -474,6 +474,12 @@
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)
+
def test_sending_headers(self):
handler = self.start_server()
req = urllib.request.Request("http://localhost:%s/" % handler.port,
« no previous file with comments | « Doc/library/urllib.request.rst ('k') | Lib/urllib/request.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7