diff options
author | Brant Knudson <bknudson@us.ibm.com> | 2015-07-24 14:14:13 -0500 |
---|---|---|
committer | Brant Knudson <bknudson@us.ibm.com> | 2015-07-26 06:54:23 -0500 |
commit | c5b03191b6714fed15bd88769c89e897257c337d (patch) | |
tree | 7fe4bc9d8662bb074ab257020d6b01a76413b0fb | |
parent | fee5ba7432ff4b282aacbb8dafac948af2006f45 (diff) | |
download | python-keystoneclient-c5b03191b6714fed15bd88769c89e897257c337d.tar.gz |
Proper deprecation for Manager.api
base.Manager's api property wasn't properly deprecated since all it
had was documentation. Proper deprecation requires use of warnings
and documentation.
bp deprecations
Change-Id: Ic5e218151e9b3f3b66f78729052680691d5ad582
-rw-r--r-- | keystoneclient/base.py | 12 | ||||
-rw-r--r-- | keystoneclient/tests/unit/test_base.py | 3 |
2 files changed, 13 insertions, 2 deletions
diff --git a/keystoneclient/base.py b/keystoneclient/base.py index eabbdc4..d2c3ea0 100644 --- a/keystoneclient/base.py +++ b/keystoneclient/base.py @@ -21,6 +21,7 @@ Base utilities to build API operation managers and objects on top of. import abc import functools +import warnings import six from six.moves import urllib @@ -91,8 +92,17 @@ class Manager(object): @property def api(self): - """Deprecated. Use `client` instead. + """The client. + + .. warning:: + + This property is deprecated as of the 1.7.0 release in favor of + :meth:`client` and may be removed in the 2.0.0 release. + """ + warnings.warn( + 'api is deprecated as of the 1.7.0 release in favor of client and ' + 'may be removed in the 2.0.0 release', DeprecationWarning) return self.client def _list(self, url, response_key, obj_class=None, body=None, **kwargs): diff --git a/keystoneclient/tests/unit/test_base.py b/keystoneclient/tests/unit/test_base.py index dcfbb13..6871702 100644 --- a/keystoneclient/tests/unit/test_base.py +++ b/keystoneclient/tests/unit/test_base.py @@ -94,7 +94,8 @@ class ManagerTest(utils.TestCase): self.mgr.resource_class = base.Resource def test_api(self): - self.assertEqual(self.mgr.api, self.client) + with self.deprecations.expect_deprecations_here(): + self.assertEqual(self.mgr.api, self.client) def test_get(self): get_mock = self.useFixture(mockpatch.PatchObject( |