From d26c7f4ca58165377f60d68babd47cf7e9377b3e Mon Sep 17 00:00:00 2001 From: ikoz Date: Wed, 16 Mar 2016 18:43:51 +0000 Subject: [PATCH] Move more init things inside AddServerCertsToClientChainMixin --- test/mitmproxy/test_server.py | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/test/mitmproxy/test_server.py b/test/mitmproxy/test_server.py index 560c7b34b..a2d1a5789 100644 --- a/test/mitmproxy/test_server.py +++ b/test/mitmproxy/test_server.py @@ -1003,6 +1003,15 @@ class TestProxyChainingSSLReconnect(tservers.HTTPUpstreamProxyTest): class AddServerCertsToClientChainMixin: + ssl = True + servercert = tutils.test_data.path("data/trusted-server.crt") + ssloptions = pathod.SSLOptions( + cn="trusted-cert", + certs=[ + ("trusted-cert", servercert) + ] + ) + def test_add_server_certs_to_client_chain(self): with open(self.servercert, "rb") as f: d = f.read() @@ -1016,33 +1025,17 @@ class AddServerCertsToClientChainMixin: assert(server_cert_found_in_client_chain == self.add_server_certs_to_client_chain) -class TestHTTPSAddServerCertsToClientChainTrue(tservers.HTTPProxyTest, AddServerCertsToClientChainMixin): +class TestHTTPSAddServerCertsToClientChainTrue(AddServerCertsToClientChainMixin, tservers.HTTPProxyTest): """ - If --add-server-certs-to-client-chain is True, then the client should receive the server's certificates + If --add-server-certs-to-client-chain is True, then the client should receive the upstream server's certificates """ add_server_certs_to_client_chain = True - ssl = True - servercert = tutils.test_data.path("data/trusted-server.crt") - ssloptions = pathod.SSLOptions( - cn="trusted-cert", - certs=[ - ("trusted-cert", servercert) - ] - ) -class TestHTTPSAddServerCertsToClientChainFalse(tservers.HTTPProxyTest, AddServerCertsToClientChainMixin): +class TestHTTPSAddServerCertsToClientChainFalse(AddServerCertsToClientChainMixin, tservers.HTTPProxyTest): """ - If --add-server-certs-to-client-chain is False, then the client should not receive the server's certificates + If --add-server-certs-to-client-chain is False, then the client should not receive the upstream server's certificates """ add_server_certs_to_client_chain = False - ssl = True - servercert = tutils.test_data.path("data/trusted-server.crt") - ssloptions = pathod.SSLOptions( - cn="trusted-cert", - certs=[ - ("trusted-cert", servercert) - ] - )