Tests: check TLS methods availability more carefully.

This commit is contained in:
Andrei Zeliankou
2023-07-10 15:24:15 +01:00
parent 3c7743344b
commit 075c6a7038
2 changed files with 12 additions and 0 deletions

View File

@@ -40,6 +40,10 @@ def test_tls_conf_command():
(_, sock) = client.get_ssl(start=True) (_, sock) = client.get_ssl(start=True)
shared_ciphers = sock.shared_ciphers() shared_ciphers = sock.shared_ciphers()
if not shared_ciphers:
pytest.skip('no shared ciphers')
protocols = list(set(c[1] for c in shared_ciphers)) protocols = list(set(c[1] for c in shared_ciphers))
protocol = sock.cipher()[1] protocol = sock.cipher()[1]

View File

@@ -73,6 +73,10 @@ def connect(ctx=None, session=None):
) )
@pytest.mark.skipif(
not hasattr(_lib, 'SSL_session_reused'),
reason='session reuse is not supported',
)
def test_tls_session(): def test_tls_session():
_, sess, ctx, reused = connect() _, sess, ctx, reused = connect()
assert not reused, 'new connection' assert not reused, 'new connection'
@@ -110,6 +114,10 @@ def test_tls_session():
assert False not in [c[-1] for c in conns_again], 'cache big reuse' assert False not in [c[-1] for c in conns_again], 'cache big reuse'
@pytest.mark.skipif(
not hasattr(_lib, 'SSL_session_reused'),
reason='session reuse is not supported',
)
def test_tls_session_timeout(): def test_tls_session_timeout():
assert 'success' in add_session(cache_size=5, timeout=1) assert 'success' in add_session(cache_size=5, timeout=1)