[7.x] Support IPv6 braces in Connection.host
Co-authored-by: Seth Michael Larson <[email protected]>
This commit is contained in:
co-authored by
Seth Michael Larson
parent
3d14e4ff27
commit
876bf90943
@@ -150,6 +150,17 @@ class TestBaseConnection(TestCase):
|
||||
|
||||
self.assertEqual([str(w.message) for w in warn], ["warning", "folded"])
|
||||
|
||||
def test_ipv6_host_and_port(self):
|
||||
for kwargs, expected_host in [
|
||||
({"host": "::1"}, "http://[::1]:9200"),
|
||||
({"host": "::1", "port": 443}, "http://[::1]:443"),
|
||||
({"host": "::1", "use_ssl": True}, "https://[::1]:9200"),
|
||||
({"host": "127.0.0.1", "port": 1234}, "http://127.0.0.1:1234"),
|
||||
({"host": "localhost", "use_ssl": True}, "https://localhost:9200"),
|
||||
]:
|
||||
conn = Connection(**kwargs)
|
||||
assert conn.host == expected_host
|
||||
|
||||
|
||||
class TestUrllib3Connection(TestCase):
|
||||
def _get_mock_connection(self, connection_params={}, response_body=b"{}"):
|
||||
|
||||
Reference in New Issue
Block a user