]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
pytests: import test_tls_cert_expired (test17)
authorTomas Krizek <tomas.krizek@nic.cz>
Thu, 15 Nov 2018 16:54:21 +0000 (17:54 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 4 Dec 2018 16:13:42 +0000 (17:13 +0100)
tests/pytests/test_tls_certs.py

index 8c4f455d1f4e2c958b877d9aeae75b74e89710cf..1eec53db59e16ec5e7d0a80ca12d509dd94069dd 100644 (file)
@@ -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)