From 25b6197e0f31785bd576bfe39c76d860a87b3bb8 Mon Sep 17 00:00:00 2001 From: Tomas Krizek Date: Thu, 15 Nov 2018 17:54:21 +0100 Subject: [PATCH] pytests: import test_tls_cert_expired (test17) --- tests/pytests/test_tls_certs.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/pytests/test_tls_certs.py b/tests/pytests/test_tls_certs.py index 8c4f455d1..1eec53db5 100644 --- a/tests/pytests/test_tls_certs.py +++ b/tests/pytests/test_tls_certs.py @@ -32,3 +32,12 @@ def test_tls_cert_hostname_mismatch(kresd_tt, sock_family): with pytest.raises(ssl.CertificateError): ssock.connect(dest) + + +def test_tls_cert_expired(kresd_tt_expired, sock_family): + sock, dest = kresd_tt_expired.stream_socket(sock_family, tls=True) + ctx = utils.make_ssl_context(verify_location=kresd_tt_expired.tls_cert_path) + ssock = ctx.wrap_socket(sock, server_hostname='transport-test-server.com') + + with pytest.raises(ssl.SSLError): + ssock.connect(dest) -- 2.47.2