diff options
author | Quentin Pradet <quentin.pradet@gmail.com> | 2020-03-16 22:05:06 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 22:05:06 +0400 |
commit | eee53a69e1af019da18635d6974f893308db0ada (patch) | |
tree | 880e7df8d2c05643e344ebcb8d4811cf816f0cb0 /test/with_dummyserver/test_socketlevel.py | |
parent | 7cb6b5d91fcd57d21285a05588e02a2ad1605f2b (diff) | |
download | urllib3-eee53a69e1af019da18635d6974f893308db0ada.tar.gz |
Ensure load_verify_locations raises SSLError for all backends (#1812)
* Ensure load_verify_locations raises SSLError for all backends
This also adds TestSSL to the classes tested in SecureTransport and
PyOpenSSL, since:
1. TestSSL was the most natural place for this test.
2. The test only makes sense when run against all SSL backends.
Co-authored-by: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
* Remove redundant check in test
pytest.raises() already checks this.
* Update test_socketlevel.py
Co-authored-by: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
Co-authored-by: Seth Michael Larson <sethmichaellarson@gmail.com>
Diffstat (limited to 'test/with_dummyserver/test_socketlevel.py')
-rw-r--r-- | test/with_dummyserver/test_socketlevel.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/with_dummyserver/test_socketlevel.py b/test/with_dummyserver/test_socketlevel.py index 71495bcd..dab353e1 100644 --- a/test/with_dummyserver/test_socketlevel.py +++ b/test/with_dummyserver/test_socketlevel.py @@ -10,6 +10,7 @@ from urllib3.exceptions import ( ProtocolError, ) from urllib3.response import httplib +from urllib3.util import ssl_wrap_socket from urllib3.util.ssl_ import HAS_SNI from urllib3.util import ssl_ from urllib3.util.timeout import Timeout @@ -37,6 +38,7 @@ except ImportError: from collections import OrderedDict import os.path from threading import Event +import os import select import socket import shutil @@ -1387,6 +1389,13 @@ class TestSSL(SocketDummyServerTestCase): pool.request("GET", "/", timeout=SHORT_TIMEOUT) context.load_default_certs.assert_not_called() + def test_load_verify_locations_exception(self): + """ + Ensure that load_verify_locations raises SSLError for all backends + """ + with pytest.raises(SSLError): + ssl_wrap_socket(None, ca_certs=os.devnull) + class TestErrorWrapping(SocketDummyServerTestCase): def test_bad_statusline(self): |