diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2014-03-05 17:25:12 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2014-03-05 17:28:04 +1300 |
commit | d65f2215cb9191a24b36ad6a4fcbf474798d3b2d (patch) | |
tree | ce2c0a84fa3e011abcd521a85b507d9bc62fd198 /test/tservers.py | |
parent | 32af66881465ae98a53665c8ddd42c02aaf492f7 (diff) | |
download | mitmproxy-d65f2215cb9191a24b36ad6a4fcbf474798d3b2d.tar.gz mitmproxy-d65f2215cb9191a24b36ad6a4fcbf474798d3b2d.tar.bz2 mitmproxy-d65f2215cb9191a24b36ad6a4fcbf474798d3b2d.zip |
Much more sophisticated cert handling
- Specify per-domain certificates and keys
- Certs are no longer regenerated for SANs
- And more. :)
Diffstat (limited to 'test/tservers.py')
-rw-r--r-- | test/tservers.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/test/tservers.py b/test/tservers.py index 540cda60..3a6a610f 100644 --- a/test/tservers.py +++ b/test/tservers.py @@ -1,4 +1,5 @@ import threading, Queue +import shutil, tempfile import flask import libpathod.test, libpathod.pathoc from libmproxy import proxy, flow, controller @@ -72,7 +73,6 @@ class ProxTestBase(object): ssl = None ssloptions = False clientcerts = False - certfile = None no_upstream_cert = False authenticator = None masterclass = TestMaster @@ -82,9 +82,10 @@ class ProxTestBase(object): cls.server = libpathod.test.Daemon(ssl=cls.ssl, ssloptions=cls.ssloptions) cls.server2 = libpathod.test.Daemon(ssl=cls.ssl, ssloptions=cls.ssloptions) pconf = cls.get_proxy_config() + cls.confdir = tempfile.gettempdir() config = proxy.ProxyConfig( no_upstream_cert = cls.no_upstream_cert, - cacert = tutils.test_data.path("data/confdir/mitmproxy-ca.pem"), + confdir = cls.confdir, authenticator = cls.authenticator, **pconf ) @@ -93,6 +94,10 @@ class ProxTestBase(object): cls.proxy = ProxyThread(tmaster) cls.proxy.start() + @classmethod + def tearDownAll(cls): + shutil.rmtree(cls.confdir) + @property def master(cls): return cls.proxy.tmaster @@ -127,9 +132,6 @@ class ProxTestBase(object): d = dict() if cls.clientcerts: d["clientcerts"] = tutils.test_data.path("data/clientcert") - if cls.certfile: - d["certfile"] =tutils.test_data.path("data/testkey.pem") - d["keyfile"] =tutils.test_data.path("data/testkey.pem") return d @@ -254,7 +256,6 @@ class ChainProxTest(ProxTestBase): """ n = 2 chain_config = [lambda: proxy.ProxyConfig( - cacert = tutils.test_data.path("data/confdir/mitmproxy-ca.pem"), )] * n @classmethod def setupAll(cls): |