diff options
author | Andrey Zelenkov <zelenkov@nginx.com> | 2019-02-28 21:19:32 +0300 |
---|---|---|
committer | Andrey Zelenkov <zelenkov@nginx.com> | 2019-02-28 21:19:32 +0300 |
commit | c1751f9de69638da89fda2ec17a693b7ec2de5c5 (patch) | |
tree | 43ca03bbcb2c43cd0146a74503838eab892aa145 | |
parent | 38ea191fbb91db000b1e68185359e612e7e47c54 (diff) | |
download | unit-c1751f9de69638da89fda2ec17a693b7ec2de5c5.tar.gz unit-c1751f9de69638da89fda2ec17a693b7ec2de5c5.tar.bz2 |
Tests: specify ssl_version option.
TLS is explicitly selected to prevent using of SSL protocol
in ssl.get_server_certificate() call for Python 3.4 and older.
-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: |