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
This commit is contained in:
@@ -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):
|
||||
|
@@ -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(
|
||||
|
Reference in New Issue
Block a user