From bf4dae70e0d163f4d485771d7d163169748fa6b3 Mon Sep 17 00:00:00 2001 From: Stanislav Laznicka Date: Jul 27 2017 08:28:58 +0000 Subject: tests: fix failing HTTPS connection Recent certificate refactoring probably unclogged some failure in handling certificates which causes test_changepw to correctly fail since it is trying to connect using an HTTPS connection without the CA certificate. This patch adds the CA cert to the connection. https://pagure.io/freeipa/issue/4985 Reviewed-By: Fraser Tweedale Reviewed-By: Rob Crittenden Reviewed-By: Martin Basti --- diff --git a/ipatests/test_ipaserver/httptest.py b/ipatests/test_ipaserver/httptest.py index c816456..13003bc 100644 --- a/ipatests/test_ipaserver/httptest.py +++ b/ipatests/test_ipaserver/httptest.py @@ -22,15 +22,7 @@ Base class for HTTP request tests from six.moves import urllib -from ipalib import api - -# Python 3 rename. The package is available in "six.moves.http_client", but -# pylint cannot handle classes from that alias -try: - import httplib -except ImportError: - # pylint: disable=import-error - import http.client as httplib +from ipalib import api, util class Unauthorized_HTTP_test(object): """ @@ -39,6 +31,7 @@ class Unauthorized_HTTP_test(object): """ app_uri = '' host = api.env.host + cacert = api.env.tls_ca_cert content_type = 'application/x-www-form-urlencoded' def send_request(self, method='POST', params=None): @@ -56,6 +49,7 @@ class Unauthorized_HTTP_test(object): headers = {'Content-Type' : self.content_type, 'Referer' : url} - conn = httplib.HTTPSConnection(self.host) + conn = util.create_https_connection( + self.host, cafile=self.cacert) conn.request(method, self.app_uri, params, headers) return conn.getresponse()