Merge "Proper deprecation for httpclient.request()"
This commit is contained in:
@@ -21,6 +21,7 @@ OpenStack Client interface. Handles the REST calls and responses.
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from debtcollector import removals
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
import requests
|
import requests
|
||||||
@@ -64,10 +65,21 @@ from keystoneclient import utils
|
|||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_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.
|
# Maintain here for compatibility.
|
||||||
USER_AGENT = client_session.USER_AGENT
|
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):
|
class _FakeRequestSession(object):
|
||||||
|
@@ -167,6 +167,7 @@ class BasicRequestTests(utils.TestCase):
|
|||||||
self.requests_mock.register_uri(method, url, text=response,
|
self.requests_mock.register_uri(method, url, text=response,
|
||||||
status_code=status_code)
|
status_code=status_code)
|
||||||
|
|
||||||
|
with self.deprecations.expect_deprecations_here():
|
||||||
return httpclient.request(url, method, **kwargs)
|
return httpclient.request(url, method, **kwargs)
|
||||||
|
|
||||||
def test_basic_params(self):
|
def test_basic_params(self):
|
||||||
|
Reference in New Issue
Block a user