diff options
| author | Senthil Kumaran <senthil@uthcode.com> | 2014-09-19 15:23:30 +0800 |
|---|---|---|
| committer | Senthil Kumaran <senthil@uthcode.com> | 2014-09-19 15:23:30 +0800 |
| commit | a5c85b3f5fc12256680a93dda9d32138d47605de (patch) | |
| tree | 8150c96aa51e8e20e0e54cf0603b7d9b9e9f9045 /Lib/test/test_urllib.py | |
| parent | ea07eb9469d1c93a26560a00f6e4ca45d4c1ecdb (diff) | |
| download | cpython-git-a5c85b3f5fc12256680a93dda9d32138d47605de.tar.gz | |
Issue #22366: urllib.request.urlopen will accept a context object (SSLContext)
as an argument which will then used be for HTTPS connection.
Patch by Alex Gaynor.
Diffstat (limited to 'Lib/test/test_urllib.py')
| -rw-r--r-- | Lib/test/test_urllib.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index 5478837103..962ef73a37 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -10,6 +10,7 @@ import unittest from unittest.mock import patch from test import support import os +import ssl import sys import tempfile from nturl2path import url2pathname, pathname2url @@ -379,6 +380,13 @@ Content-Type: text/html; charset=iso-8859-1 with support.check_warnings(('',DeprecationWarning)): urllib.request.URLopener() + def test_cafile_and_context(self): + context = ssl.create_default_context() + with self.assertRaises(ValueError): + urllib.request.urlopen( + "https://localhost", cafile="/nonexistent/path", context=context + ) + class urlopen_DataTests(unittest.TestCase): """Test urlopen() opening a data URL.""" |
