From 7365b267e2ac1ad6fd323c9bdb121a560b101337 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Thu, 9 Dec 2021 18:25:10 +0200 Subject: first ssl test - validates an invalid certificate --- tests/test_ssl.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/test_ssl.py (limited to 'tests/test_ssl.py') diff --git a/tests/test_ssl.py b/tests/test_ssl.py new file mode 100644 index 0000000..4064ae3 --- /dev/null +++ b/tests/test_ssl.py @@ -0,0 +1,17 @@ +import pytest +import redis +from redis.exceptions import ConnectionError + + +class TestSSL: + """Tests for SSL connections""" + + def test_ssl_with_invalid_cert(self, request): + ssl_url = request.config.option.redis_ssl_url + sslclient = redis.from_url(ssl_url) + with pytest.raises(ConnectionError) as e: + sslclient.ping() + assert 'SSL: CERTIFICATE_VERIFY_FAILED' in str(e) + + def test_ssl_connection_creation(self, sslclient): + assert sslclient.ping() \ No newline at end of file -- cgit v1.2.1