diff options
author | Brant Knudson <bknudson@us.ibm.com> | 2015-07-24 14:52:12 -0500 |
---|---|---|
committer | Brant Knudson <bknudson@us.ibm.com> | 2015-07-26 06:54:23 -0500 |
commit | 9f17732308c13264c3ea4c16771153f2e86369b9 (patch) | |
tree | a0347a6b32a62e831f18f7c1aff53209ce089f42 | |
parent | fb28e1a2b80c21ff6a9728654b4d736add810ae1 (diff) | |
download | python-keystoneclient-9f17732308c13264c3ea4c16771153f2e86369b9.tar.gz |
Proper deprecation for httpclient.request()
httpclient.request() wasn't properly deprecated since it was only
mentioned in a comment. Proper deprecation requires use of
warnings/debtcollector and documentation.
bp deprecations
Change-Id: Id35d64a8b2d536c5de90e398b2a7680fa30881d6
-rw-r--r-- | keystoneclient/httpclient.py | 16 | ||||
-rw-r--r-- | keystoneclient/tests/unit/test_http.py | 3 |
2 files changed, 16 insertions, 3 deletions
diff --git a/keystoneclient/httpclient.py b/keystoneclient/httpclient.py index 9c51f6d..37c6a4d 100644 --- a/keystoneclient/httpclient.py +++ b/keystoneclient/httpclient.py @@ -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): diff --git a/keystoneclient/tests/unit/test_http.py b/keystoneclient/tests/unit/test_http.py index 436c374..9a8bee2 100644 --- a/keystoneclient/tests/unit/test_http.py +++ b/keystoneclient/tests/unit/test_http.py @@ -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' |