Merge "Add back --insecure option to CURL debug"
This commit is contained in:
commit
c1adff769e
keystoneclient
@ -55,7 +55,8 @@ class Session(object):
|
||||
:param verify: The verification arguments to pass to requests. These
|
||||
are of the same form as requests expects, so True or
|
||||
False to verify (or not) against system certificates or
|
||||
a path to a bundle or CA certs to check against.
|
||||
a path to a bundle or CA certs to check against or None
|
||||
for requests to attempt to locate and use certificates.
|
||||
(optional, defaults to True)
|
||||
:param cert: A client certificate to pass to requests. These are of the
|
||||
same form as requests expects. Either a single filename
|
||||
@ -171,6 +172,11 @@ class Session(object):
|
||||
|
||||
string_parts = ['curl -i']
|
||||
|
||||
# NOTE(jamielennox): None means let requests do its default validation
|
||||
# so we need to actually check that this is False.
|
||||
if self.verify is False:
|
||||
string_parts.append('--insecure')
|
||||
|
||||
if method:
|
||||
string_parts.extend(['-X', method])
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
import httpretty
|
||||
import mock
|
||||
import requests
|
||||
import six
|
||||
|
||||
from keystoneclient.auth import base
|
||||
from keystoneclient import exceptions
|
||||
@ -141,6 +142,23 @@ class SessionTests(utils.TestCase):
|
||||
self.assertRaises(exceptions.InternalServerError,
|
||||
session.get, self.TEST_URL)
|
||||
|
||||
@httpretty.activate
|
||||
def test_session_debug_output(self):
|
||||
session = client_session.Session(verify=False)
|
||||
headers = {'HEADERA': 'HEADERVALB'}
|
||||
body = 'BODYRESPONSE'
|
||||
self.stub_url(httpretty.POST, body=body)
|
||||
session.post(self.TEST_URL, headers=headers)
|
||||
|
||||
self.assertIn('curl', self.logger.output)
|
||||
self.assertIn('POST', self.logger.output)
|
||||
self.assertIn('--insecure', self.logger.output)
|
||||
self.assertIn(body, self.logger.output)
|
||||
|
||||
for k, v in six.iteritems(headers):
|
||||
self.assertIn(k, self.logger.output)
|
||||
self.assertIn(v, self.logger.output)
|
||||
|
||||
|
||||
class RedirectTests(utils.TestCase):
|
||||
|
||||
|
@ -12,9 +12,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import sys
|
||||
import time
|
||||
|
||||
import fixtures
|
||||
import httpretty
|
||||
import mock
|
||||
from mox3 import mox
|
||||
@ -40,6 +42,7 @@ class TestCase(testtools.TestCase):
|
||||
def setUp(self):
|
||||
super(TestCase, self).setUp()
|
||||
self.mox = mox.Mox()
|
||||
self.logger = self.useFixture(fixtures.FakeLogger(level=logging.DEBUG))
|
||||
self.time_patcher = mock.patch.object(time, 'time', lambda: 1234)
|
||||
self.time_patcher.start()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user