mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
cert validation fixes - Attempt 2 (#55953)
* Attempt 2 of cert validation fixes * Remove unused code * Cleanup the tmp cert using atexit * Fix linting issues * Only add SSLValidationHandler when not HAS_SSLCONTEXT * Catch value errors on non PEM certs * Only catch NotImplementedError to avoid masking issues * set self._context even with PyOpenSSLContext for conformity * Fix error building * normalize how we interact with the context we create * Remove unused code * Address test for py3.7 message difference * open_url should pass the ca_path through * Account for new error in url lookup test * Guard some code behind whether or not we are validating certs * Make _make_context public * Move atexit.register up to where the tmp file is created
This commit is contained in:
@@ -67,7 +67,7 @@ def test_fetch_url(open_url_mock, fake_ansible_module):
|
||||
open_url_mock.assert_called_once_with('http://ansible.com/', client_cert=None, client_key=None, cookies=kwargs['cookies'], data=None,
|
||||
follow_redirects='urllib2', force=False, force_basic_auth='', headers=None,
|
||||
http_agent='ansible-httpget', last_mod_time=None, method=None, timeout=10, url_password='', url_username='',
|
||||
use_proxy=True, validate_certs=True, use_gssapi=False, unix_socket=None)
|
||||
use_proxy=True, validate_certs=True, use_gssapi=False, unix_socket=None, ca_path=None)
|
||||
|
||||
|
||||
def test_fetch_url_params(open_url_mock, fake_ansible_module):
|
||||
@@ -89,7 +89,7 @@ def test_fetch_url_params(open_url_mock, fake_ansible_module):
|
||||
open_url_mock.assert_called_once_with('http://ansible.com/', client_cert='client.pem', client_key='client.key', cookies=kwargs['cookies'], data=None,
|
||||
follow_redirects='all', force=False, force_basic_auth=True, headers=None,
|
||||
http_agent='ansible-test', last_mod_time=None, method=None, timeout=10, url_password='passwd', url_username='user',
|
||||
use_proxy=True, validate_certs=False, use_gssapi=False, unix_socket=None)
|
||||
use_proxy=True, validate_certs=False, use_gssapi=False, unix_socket=None, ca_path=None)
|
||||
|
||||
|
||||
def test_fetch_url_cookies(mocker, fake_ansible_module):
|
||||
|
||||
Reference in New Issue
Block a user