mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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 <ftweedal@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
committed by
Pavel Vomacka
parent
43c74d3333
commit
bf4dae70e0
@@ -22,15 +22,7 @@ Base class for HTTP request tests
|
|||||||
|
|
||||||
from six.moves import urllib
|
from six.moves import urllib
|
||||||
|
|
||||||
from ipalib import api
|
from ipalib import api, util
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
class Unauthorized_HTTP_test(object):
|
class Unauthorized_HTTP_test(object):
|
||||||
"""
|
"""
|
||||||
@@ -39,6 +31,7 @@ class Unauthorized_HTTP_test(object):
|
|||||||
"""
|
"""
|
||||||
app_uri = ''
|
app_uri = ''
|
||||||
host = api.env.host
|
host = api.env.host
|
||||||
|
cacert = api.env.tls_ca_cert
|
||||||
content_type = 'application/x-www-form-urlencoded'
|
content_type = 'application/x-www-form-urlencoded'
|
||||||
|
|
||||||
def send_request(self, method='POST', params=None):
|
def send_request(self, method='POST', params=None):
|
||||||
@@ -56,6 +49,7 @@ class Unauthorized_HTTP_test(object):
|
|||||||
headers = {'Content-Type' : self.content_type,
|
headers = {'Content-Type' : self.content_type,
|
||||||
'Referer' : url}
|
'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)
|
conn.request(method, self.app_uri, params, headers)
|
||||||
return conn.getresponse()
|
return conn.getresponse()
|
||||||
|
|||||||
Reference in New Issue
Block a user