Skip to content

Commit 081f1af

Browse files
committed
Fix: correct indentation in TLS auto-negotiation test
1 parent 7463287 commit 081f1af

1 file changed

Lines changed: 36 additions & 36 deletions

File tree

vertica_python/tests/integration_tests/test_tls.py

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -313,45 +313,45 @@ def _get_tls_version(self, conn):
313313
return None
314314

315315
def test_tls13_support_auto_negotiation(self):
316-
"""
317-
Verify that the client supports TLS 1.3 negotiation.
318-
If the server supports TLS 1.3, the connection should establish using it.
319-
If the server supports only TLS 1.2, the connection should still succeed.
320-
"""
321-
322-
# Set up server certificates and enable TLS
323-
CA_cert = self._generate_and_set_certificates()
324-
325-
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
326-
ssl_context.verify_mode = ssl.CERT_REQUIRED
327-
ssl_context.check_hostname = True
328-
ssl_context.load_verify_locations(cadata=CA_cert)
329-
330-
self._conn_info['ssl'] = ssl_context
331-
332-
with self._connect() as conn:
333-
# First ensure TLS really got enabled on server
334-
res = self._query_and_fetchone(self.SSL_STATE_SQL)
335-
if res[0] != 'Server':
336-
self.skipTest("TLS is not configured on server")
337-
338-
# Prefer public API, fall back only if needed
339-
tls_version = self._get_tls_version(conn)
340-
341-
self.assertIsNotNone(
342-
tls_version,
343-
"Could not determine negotiated TLS version"
344-
)
345-
346-
self.assertIn(
347-
tls_version,
348-
("TLSv1.2", "TLSv1.3"),
349-
msg=f"Unexpected TLS version negotiated: {tls_version}"
350-
)
316+
"""
317+
Verify that the client supports TLS 1.3 negotiation.
318+
If the server supports TLS 1.3, the connection should establish using it.
319+
If the server supports only TLS 1.2, the connection should still succeed.
320+
"""
321+
322+
# Set up server certificates and enable TLS
323+
CA_cert = self._generate_and_set_certificates()
324+
325+
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
326+
ssl_context.verify_mode = ssl.CERT_REQUIRED
327+
ssl_context.check_hostname = True
328+
ssl_context.load_verify_locations(cadata=CA_cert)
329+
330+
self._conn_info['ssl'] = ssl_context
331+
332+
with self._connect() as conn:
333+
# First ensure TLS really got enabled on server
334+
res = self._query_and_fetchone(self.SSL_STATE_SQL)
335+
if res[0] != 'Server':
336+
self.skipTest("TLS is not configured on server")
337+
338+
# Prefer public API, fall back only if needed
339+
tls_version = self._get_tls_version(conn)
340+
341+
self.assertIsNotNone(
342+
tls_version,
343+
"Could not determine negotiated TLS version"
344+
)
345+
346+
self.assertIn(
347+
tls_version,
348+
("TLSv1.2", "TLSv1.3"),
349+
msg=f"Unexpected TLS version negotiated: {tls_version}"
350+
)
351351

352352
def test_sslcontext_mutual_TLS(self):
353353
# Setting certificates with TLS configuration
354-
CA_cert = self._generate_and_set_certificates(mutual_mode=True)
354+
355355

356356
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
357357
ssl_context.verify_mode = ssl.CERT_REQUIRED

0 commit comments

Comments
 (0)