diff --git a/pyignite/connection/connection.py b/pyignite/connection/connection.py index 3d86f01..4596e23 100644 --- a/pyignite/connection/connection.py +++ b/pyignite/connection/connection.py @@ -48,9 +48,6 @@ def __init__(self, client, host: str = None, port: int = None, username: str = N check_ssl_params(ssl_params) - if self.username and self.password and 'use_ssl' not in ssl_params: - ssl_params['use_ssl'] = True - self.ssl_params = ssl_params self._failed = False diff --git a/tests/security/test_auth.py b/tests/security/test_auth.py index 83ac780..f4ca29b 100644 --- a/tests/security/test_auth.py +++ b/tests/security/test_auth.py @@ -46,8 +46,7 @@ def cleanup(): clear_ignite_work_dir() -def test_auth_success(with_ssl, ssl_params, caplog): - ssl_params['use_ssl'] = with_ssl +def check_auth_success(ssl_params, caplog): listener = AccumulatingConnectionListener() client = Client(username=DEFAULT_IGNITE_USERNAME, password=DEFAULT_IGNITE_PASSWORD, event_listeners=[listener], **ssl_params) @@ -60,9 +59,18 @@ def test_auth_success(with_ssl, ssl_params, caplog): __assert_successful_connect_events(conn, listener) -@pytest.mark.asyncio -async def test_auth_success_async(with_ssl, ssl_params, caplog): +def test_auth_success_no_explicit_ssl(with_ssl, ssl_params, caplog): + if with_ssl: + ssl_params['use_ssl'] = with_ssl + check_auth_success(ssl_params, caplog) + + +def test_auth_success(with_ssl, ssl_params, caplog): ssl_params['use_ssl'] = with_ssl + check_auth_success(ssl_params, caplog) + + +async def check_auth_success_async(ssl_params, caplog): listener = AccumulatingConnectionListener() client = AioClient(username=DEFAULT_IGNITE_USERNAME, password=DEFAULT_IGNITE_PASSWORD, event_listeners=[listener], **ssl_params) @@ -75,6 +83,19 @@ async def test_auth_success_async(with_ssl, ssl_params, caplog): __assert_successful_connect_events(conn, listener) +@pytest.mark.asyncio +async def test_auth_success_no_explicit_ssl_async(with_ssl, ssl_params, caplog): + if with_ssl: + ssl_params['use_ssl'] = with_ssl + await check_auth_success_async(ssl_params, caplog) + + +@pytest.mark.asyncio +async def test_auth_success_async(with_ssl, ssl_params, caplog): + ssl_params['use_ssl'] = with_ssl + await check_auth_success_async(ssl_params, caplog) + + def __assert_successful_connect_log(conn, caplog): assert any(re.match(rf'Connecting to node\(address={conn.host},\s+port={conn.port}', r.message) for r in caplog.records)