summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--test/test_tls.py2
-rw-r--r--test/unit/applications/tls.py17
2 files changed, 14 insertions, 5 deletions
diff --git a/test/test_tls.py b/test/test_tls.py
index df3499da..076a2c38 100644
--- a/test/test_tls.py
+++ b/test/test_tls.py
@@ -145,6 +145,8 @@ class TestTLS(TestApplicationTLS):
def test_tls_certificate_key_ec(self):
self.load('empty')
+ self.openssl_conf()
+
subprocess.call(
[
'openssl',
diff --git a/test/unit/applications/tls.py b/test/unit/applications/tls.py
index 0f1053bf..6e8deefb 100644
--- a/test/unit/applications/tls.py
+++ b/test/unit/applications/tls.py
@@ -1,3 +1,4 @@
+import os
import ssl
import subprocess
from unit.applications.proto import TestApplicationProto
@@ -12,6 +13,8 @@ class TestApplicationTLS(TestApplicationProto):
self.context.verify_mode = ssl.CERT_NONE
def certificate(self, name='default', load=True):
+ self.openssl_conf()
+
subprocess.call(
[
'openssl',
@@ -59,13 +62,13 @@ class TestApplicationTLS(TestApplicationProto):
return ssl.get_server_certificate(addr, ssl_version=ssl_version)
- def load(self, script, name=None):
- if name is None:
- name = script
+ def openssl_conf(self):
+ conf_path = self.testdir + '/openssl.conf'
- # create default openssl configuration
+ if os.path.exists(conf_path):
+ return
- with open(self.testdir + '/openssl.conf', 'w') as f:
+ with open(conf_path, 'w') as f:
f.write(
"""[ req ]
default_bits = 2048
@@ -74,6 +77,10 @@ distinguished_name = req_distinguished_name
[ req_distinguished_name ]"""
)
+ def load(self, script, name=None):
+ if name is None:
+ name = script
+
script_path = self.current_dir + '/python/' + script
self._load_conf(