summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib2_localnet.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-06-06 21:17:45 (GMT)
committerGitHub <noreply@github.com>2023-06-06 21:17:45 (GMT)
commit2587b9f64eefde803a5e0b050171ad5f6654f31b (patch)
tree5304fb7ff2534429db4b07a907f8c06cab0a19dc /Lib/test/test_urllib2_localnet.py
parent94d5f9827da4bf4b1e61c134fe29904b2b92f124 (diff)
downloadcpython-2587b9f64eefde803a5e0b050171ad5f6654f31b.zip
cpython-2587b9f64eefde803a5e0b050171ad5f6654f31b.tar.gz
cpython-2587b9f64eefde803a5e0b050171ad5f6654f31b.tar.bz2
gh-105382: Remove urllib.request cafile parameter (#105384)
Remove cafile, capath and cadefault parameters of the urllib.request.urlopen() function, deprecated in Python 3.6.
Diffstat (limited to 'Lib/test/test_urllib2_localnet.py')
-rw-r--r--Lib/test/test_urllib2_localnet.py25
1 files changed, 0 insertions, 25 deletions
diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py
index f472935..1c5b027 100644
--- a/Lib/test/test_urllib2_localnet.py
+++ b/Lib/test/test_urllib2_localnet.py
@@ -568,31 +568,6 @@ class TestUrlopen(unittest.TestCase):
data = self.urlopen("https://localhost:%s/bizarre" % handler.port, context=context)
self.assertEqual(data, b"we care a bit")
- def test_https_with_cafile(self):
- handler = self.start_https_server(certfile=CERT_localhost)
- with warnings_helper.check_warnings(('', DeprecationWarning)):
- # Good cert
- data = self.urlopen("https://localhost:%s/bizarre" % handler.port,
- cafile=CERT_localhost)
- self.assertEqual(data, b"we care a bit")
- # Bad cert
- with self.assertRaises(urllib.error.URLError) as cm:
- self.urlopen("https://localhost:%s/bizarre" % handler.port,
- cafile=CERT_fakehostname)
- # Good cert, but mismatching hostname
- handler = self.start_https_server(certfile=CERT_fakehostname)
- with self.assertRaises(urllib.error.URLError) as cm:
- 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 warnings_helper.check_warnings(('', DeprecationWarning)):
- with self.assertRaises(urllib.error.URLError) as cm:
- self.urlopen("https://localhost:%s/bizarre" % handler.port,
- cadefault=True)
-
def test_https_sni(self):
if ssl is None:
self.skipTest("ssl module required")