From 80690b79062c739fc8adfc725d39a68d4b65b43a Mon Sep 17 00:00:00 2001 From: "Michael J. Bazzinotti" Date: Mon, 28 Dec 2015 15:20:45 -0500 Subject: [docs/libmproxy/test] Support single client-side cert file as argument to --client-certs --- test/test_server.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/test_server.py') diff --git a/test/test_server.py b/test/test_server.py index e48e46fe..09cfa381 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -1,3 +1,4 @@ +import os import socket import time from OpenSSL import SSL @@ -316,6 +317,14 @@ class TestHTTPS(tservers.HTTPProxTest, CommonMixin, TcpMixin): clientcerts = True def test_clientcert(self): + self.config.clientcerts = os.path.join( + tutils.test_data.path("data/clientcert"), "client.pem") + f = self.pathod("304") + assert f.status_code == 304 + assert self.server.last_log()["request"]["clientcert"]["keyinfo"] + + def test_clientcerts(self): + self.config.clientcerts = tutils.test_data.path("data/clientcert") f = self.pathod("304") assert f.status_code == 304 assert self.server.last_log()["request"]["clientcert"]["keyinfo"] -- cgit v1.2.3 From 09168e1274b0e33448811c39efa3fbdd2aeff756 Mon Sep 17 00:00:00 2001 From: "Michael J. Bazzinotti" Date: Tue, 29 Dec 2015 11:48:02 -0500 Subject: client-cert: Simplify and cleanup simplify the error message when cert path does not exist. During tests, reset the clientcerts proxy config setting to None Remove now-unused clientcerts code from class ProxTestBase --- test/test_server.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'test/test_server.py') diff --git a/test/test_server.py b/test/test_server.py index 09cfa381..85c766eb 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -314,21 +314,24 @@ class TestHTTPAuth(tservers.HTTPProxTest): class TestHTTPS(tservers.HTTPProxTest, CommonMixin, TcpMixin): ssl = True ssloptions = pathod.SSLOptions(request_client_cert=True) - clientcerts = True - - def test_clientcert(self): - self.config.clientcerts = os.path.join( - tutils.test_data.path("data/clientcert"), "client.pem") - f = self.pathod("304") - assert f.status_code == 304 - assert self.server.last_log()["request"]["clientcert"]["keyinfo"] - - def test_clientcerts(self): - self.config.clientcerts = tutils.test_data.path("data/clientcert") - f = self.pathod("304") - assert f.status_code == 304 - assert self.server.last_log()["request"]["clientcert"]["keyinfo"] + def test_clientcert_file(self): + try: + self.config.clientcerts = os.path.join( + tutils.test_data.path("data/clientcert"), "client.pem") + f = self.pathod("304") + assert f.status_code == 304 + assert self.server.last_log()["request"]["clientcert"]["keyinfo"] + finally: + self.config.clientcerts = None + def test_clientcert_dir(self): + try: + self.config.clientcerts = tutils.test_data.path("data/clientcert") + f = self.pathod("304") + assert f.status_code == 304 + assert self.server.last_log()["request"]["clientcert"]["keyinfo"] + finally: + self.config.clientcerts = None def test_error_post_connect(self): p = self.pathoc() assert p.request("get:/:i0,'invalid\r\n\r\n'").status_code == 400 -- cgit v1.2.3