summaryrefslogtreecommitdiffhomepage
path: root/test/unit/applications/tls.py
diff options
context:
space:
mode:
authorAndrey Zelenkov <zelenkov@nginx.com>2019-09-14 14:44:35 +0300
committerAndrey Zelenkov <zelenkov@nginx.com>2019-09-14 14:44:35 +0300
commit65ca2d7b198bf573fe3caf5e75bf6bd3a172820b (patch)
tree4964d0f5f4bd8b68fe06d8f975c0287b8a240951 /test/unit/applications/tls.py
parent962cdb66590b9f9ec57e0a6aa5d0cb359bb8f145 (diff)
downloadunit-65ca2d7b198bf573fe3caf5e75bf6bd3a172820b.tar.gz
unit-65ca2d7b198bf573fe3caf5e75bf6bd3a172820b.tar.bz2
Tests: refactored prerequisites model.
Diffstat (limited to 'test/unit/applications/tls.py')
-rw-r--r--test/unit/applications/tls.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/unit/applications/tls.py b/test/unit/applications/tls.py
index 6e8deefb..1290279d 100644
--- a/test/unit/applications/tls.py
+++ b/test/unit/applications/tls.py
@@ -1,4 +1,5 @@
import os
+import re
import ssl
import subprocess
from unit.applications.proto import TestApplicationProto
@@ -12,6 +13,27 @@ class TestApplicationTLS(TestApplicationProto):
self.context.check_hostname = False
self.context.verify_mode = ssl.CERT_NONE
+ @classmethod
+ def setUpClass(cls, complete_check=True):
+ unit = super().setUpClass(complete_check=False)
+
+ # check tls module
+
+ try:
+ subprocess.check_output(['which', 'openssl'])
+
+ output = subprocess.check_output(
+ [unit.unitd, '--version'], stderr=subprocess.STDOUT
+ )
+
+ if re.search('--openssl', output.decode()):
+ cls.available['modules']['openssl'] = []
+
+ except:
+ pass
+
+ return unit if not complete_check else unit.complete()
+
def certificate(self, name='default', load=True):
self.openssl_conf()