diff options
-rw-r--r-- | test/unit.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/unit.py b/test/unit.py index a0de82e7..6cca7f48 100644 --- a/test/unit.py +++ b/test/unit.py @@ -718,7 +718,19 @@ class TestUnitApplicationTLS(TestUnitApplicationProto): **kwargs) def get_server_certificate(self, addr=('127.0.0.1', 7080)): - return ssl.get_server_certificate(addr) + + ssl_list = dir(ssl) + + if 'PROTOCOL_TLS' in ssl_list: + ssl_version = ssl.PROTOCOL_TLS + + elif 'PROTOCOL_TLSv1_2' in ssl_list: + ssl_version = ssl.PROTOCOL_TLSv1_2 + + else: + ssl_version = ssl.PROTOCOL_TLSv1_1 + + return ssl.get_server_certificate(addr, ssl_version=ssl_version) def load(self, script, name=None): if name is None: |