mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
Support unix socket with urls/uri (#43560)
* First pass at allowing unix socket with urls/uri. See #42341 * Only insert handler as needed * Fix and add tests * Add HTTPS functionality for unix sockets * Additional test fixes * Create context manager for monkey patching HTTPConnection.connect, de-dupe code, raise better errors * doc * Add a few more tests * Fix __call__ * Remove unused import * Patch HTTPConnection.connect with the functionality we want, instead of duplicating code and disabling * Fix var name * Remove unused var * Add changelog fragment * Update uri docs * Fix rebase indentation issue
This commit is contained in:
@@ -89,3 +89,11 @@ def test_ParseResultDottedDict():
|
||||
assert parts[0] == dotted_parts.scheme
|
||||
|
||||
assert dotted_parts.as_list() == list(parts)
|
||||
|
||||
|
||||
def test_unix_socket_patch_httpconnection_connect(mocker):
|
||||
unix_conn = mocker.patch.object(urls.UnixHTTPConnection, 'connect')
|
||||
conn = urls.httplib.HTTPConnection('ansible.com')
|
||||
with urls.unix_socket_patch_httpconnection_connect():
|
||||
conn.connect()
|
||||
assert unix_conn.call_count == 1
|
||||
|
||||
Reference in New Issue
Block a user