mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 06:46:15 +00:00
Test security warnings (#3289)
Verify that the expected warnings are emitted with SubjectAltNameWarning emitted on all environments due to the https server provided by httpbin_secure.
This commit is contained in:
committed by
Ian Cordasco
parent
e12ee9407c
commit
400d27f982
@@ -1 +1,22 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""Requests test package initialisation."""
|
||||
|
||||
import warnings
|
||||
|
||||
try:
|
||||
import urllib3 as urllib3_package
|
||||
except ImportError:
|
||||
urllib3_package = False
|
||||
|
||||
from requests.packages import urllib3 as urllib3_bundle
|
||||
|
||||
if urllib3_package is urllib3_bundle:
|
||||
from urllib3.exceptions import SNIMissingWarning
|
||||
else:
|
||||
from requests.packages.urllib3.exceptions import SNIMissingWarning
|
||||
|
||||
# urllib3 sets SNIMissingWarning to only go off once,
|
||||
# while this test suite requires it to always fire
|
||||
# so that it occurs during test_requests.test_https_warnings
|
||||
warnings.simplefilter('always', SNIMissingWarning)
|
||||
|
||||
Reference in New Issue
Block a user