Merge "Proper deprecation for httpclient.request()"

This commit is contained in:
Jenkins 2015-08-03 21:43:51 +00:00 committed by Gerrit Code Review
commit 1c76ed9266
2 changed files with 16 additions and 3 deletions
keystoneclient

@ -21,6 +21,7 @@ OpenStack Client interface. Handles the REST calls and responses.
import logging
from debtcollector import removals
from oslo_serialization import jsonutils
import pkg_resources
import requests
@ -64,10 +65,21 @@ from keystoneclient import utils
_logger = logging.getLogger(__name__)
# These variables are moved and using them via httpclient is deprecated.
# This variable is moved and using it via httpclient is deprecated.
# Maintain here for compatibility.
USER_AGENT = client_session.USER_AGENT
request = client_session.request
@removals.remove(message='Use keystoneclient.session.request instead.',
version='1.7.0', removal_version='2.0.0')
def request(*args, **kwargs):
"""Make a request.
This function is deprecated as of the 1.7.0 release in favor of
:func:`keystoneclient.session.request` and may be removed in the
2.0.0 release.
"""
return client_session.request(*args, **kwargs)
class _FakeRequestSession(object):

@ -167,7 +167,8 @@ class BasicRequestTests(utils.TestCase):
self.requests_mock.register_uri(method, url, text=response,
status_code=status_code)
return httpclient.request(url, method, **kwargs)
with self.deprecations.expect_deprecations_here():
return httpclient.request(url, method, **kwargs)
def test_basic_params(self):
method = 'GET'