Changeset e3e0de1 in mod_gnutls for test/mgstest/tests.py
- Timestamp:
- Dec 7, 2019, 9:42:07 AM (16 months ago)
- Branches:
- asyncio, master, proxy-ticket
- Children:
- 8b72599
- Parents:
- 09d923b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/mgstest/tests.py
r09d923b re3e0de1 21 21 """ 22 22 23 import os 23 24 import re 24 25 import subprocess 25 26 import yaml 27 28 from string import Template 26 29 27 30 from . import TestExpectationFailed … … 42 45 yaml_tag = '!connection' 43 46 44 def __init__(self, actions, gnutls_params=[], transport='gnutls'): 47 def __init__(self, actions, host=None, port=None, gnutls_params=[], 48 transport='gnutls'): 45 49 self.gnutls_params = gnutls_params 46 50 self.actions = actions 47 51 self.transport = transport 52 if host: 53 self.host = subst_env(host) 54 else: 55 self.host = os.environ.get('TEST_TARGET', 'localhost') 56 if port: 57 self.port = int(subst_env(port)) 58 else: 59 self.port = int(os.environ.get('TEST_PORT', 8000)) 48 60 49 61 def __repr__(self): 50 62 return (f'{self.__class__.__name__!s}' 51 f'(gnutls_params={self.gnutls_params!r}, ' 63 f'(host={self.host!r}, port={self.port!r}, ' 64 f'gnutls_params={self.gnutls_params!r}, ' 52 65 f'actions={self.actions!r}, transport={self.transport!r})') 53 66 54 def run(self, host, port,timeout=5.0):67 def run(self, timeout=5.0): 55 68 # note: "--logfile" option requires GnuTLS version >= 3.6.7 56 69 command = ['gnutls-cli', '--logfile=/dev/stderr'] 57 70 for s in self.gnutls_params: 58 71 command.append('--' + s) 59 command = command + ['-p', str( port),host]60 61 conn = HTTPSubprocessConnection(command, host,port,72 command = command + ['-p', str(self.port), self.host] 73 74 conn = HTTPSubprocessConnection(command, self.host, self.port, 62 75 output_filter=filter_cert_log, 63 76 timeout=timeout) … … 322 335 s = s + '\n\n' + body 323 336 return s 337 338 339 340 def subst_env(text): 341 t = Template(text) 342 return t.substitute(os.environ)
Note: See TracChangeset
for help on using the changeset viewer.