Proper deprecation for AccessInfo scoped property
Properly deprecate constructing AccessInfo's scoped parameter. bp deprecations Change-Id: I8f81c75eb8e758feb9d4c62ce7f041957562e766
This commit is contained in:
@@ -258,7 +258,10 @@ class AccessInfo(dict):
|
||||
"""Returns true if the authorization token was scoped to a tenant
|
||||
(project), and contains a populated service catalog.
|
||||
|
||||
This is deprecated, use project_scoped instead.
|
||||
.. warning::
|
||||
|
||||
This is deprecated as of the 1.7.0 release in favor of
|
||||
project_scoped and may be removed in the 2.0.0 release.
|
||||
|
||||
:returns: bool
|
||||
"""
|
||||
@@ -537,6 +540,13 @@ class AccessInfoV2(AccessInfo):
|
||||
|
||||
@property
|
||||
def scoped(self):
|
||||
"""Deprecated as of the 1.7.0 release in favor of project_scoped and
|
||||
may be removed in the 2.0.0 release.
|
||||
"""
|
||||
warnings.warn(
|
||||
'scoped is deprecated as of the 1.7.0 release in favor of '
|
||||
'project_scoped and may be removed in the 2.0.0 release.',
|
||||
DeprecationWarning)
|
||||
if ('serviceCatalog' in self
|
||||
and self['serviceCatalog']
|
||||
and 'tenant' in self['token']):
|
||||
@@ -759,6 +769,13 @@ class AccessInfoV3(AccessInfo):
|
||||
|
||||
@property
|
||||
def scoped(self):
|
||||
"""Deprecated as of the 1.7.0 release in favor of project_scoped and
|
||||
may be removed in the 2.0.0 release.
|
||||
"""
|
||||
warnings.warn(
|
||||
'scoped is deprecated as of the 1.7.0 release in favor of '
|
||||
'project_scoped and may be removed in the 2.0.0 release.',
|
||||
DeprecationWarning)
|
||||
return ('catalog' in self and self['catalog'] and 'project' in self)
|
||||
|
||||
@property
|
||||
|
@@ -512,6 +512,7 @@ class V3IdentityPlugin(utils.TestCase):
|
||||
|
||||
auth_ref = a.get_access(s)
|
||||
|
||||
with self.deprecations.expect_deprecations_here():
|
||||
self.assertFalse(auth_ref.scoped)
|
||||
body = self.requests_mock.last_request.json()
|
||||
|
||||
|
@@ -48,6 +48,7 @@ class AccessInfoTest(utils.TestCase, testresources.ResourcedTestCase):
|
||||
self.assertIsNone(auth_ref.auth_url)
|
||||
self.assertIsNone(auth_ref.management_url)
|
||||
|
||||
with self.deprecations.expect_deprecations_here():
|
||||
self.assertFalse(auth_ref.scoped)
|
||||
self.assertFalse(auth_ref.domain_scoped)
|
||||
self.assertFalse(auth_ref.project_scoped)
|
||||
@@ -106,6 +107,7 @@ class AccessInfoTest(utils.TestCase, testresources.ResourcedTestCase):
|
||||
self.assertEqual(auth_ref.user_domain_id, 'default')
|
||||
self.assertEqual(auth_ref.user_domain_name, 'Default')
|
||||
|
||||
with self.deprecations.expect_deprecations_here():
|
||||
self.assertTrue(auth_ref.scoped)
|
||||
self.assertTrue(auth_ref.project_scoped)
|
||||
self.assertFalse(auth_ref.domain_scoped)
|
||||
@@ -127,6 +129,7 @@ class AccessInfoTest(utils.TestCase, testresources.ResourcedTestCase):
|
||||
self.assertEqual(auth_ref.user_domain_id, 'default')
|
||||
self.assertEqual(auth_ref.user_domain_name, 'Default')
|
||||
self.assertEqual(auth_ref.role_names, ['role1', 'role2'])
|
||||
with self.deprecations.expect_deprecations_here():
|
||||
self.assertFalse(auth_ref.scoped)
|
||||
|
||||
def test_grizzly_token(self):
|
||||
|
@@ -34,6 +34,7 @@ class KeystoneClientTest(utils.TestCase):
|
||||
password='password',
|
||||
auth_url=self.TEST_URL)
|
||||
self.assertIsNotNone(c.auth_ref)
|
||||
with self.deprecations.expect_deprecations_here():
|
||||
self.assertFalse(c.auth_ref.scoped)
|
||||
self.assertFalse(c.auth_ref.domain_scoped)
|
||||
self.assertFalse(c.auth_ref.project_scoped)
|
||||
@@ -51,6 +52,7 @@ class KeystoneClientTest(utils.TestCase):
|
||||
tenant_name='exampleproject',
|
||||
auth_url=self.TEST_URL)
|
||||
self.assertIsNotNone(c.auth_ref)
|
||||
with self.deprecations.expect_deprecations_here():
|
||||
self.assertTrue(c.auth_ref.scoped)
|
||||
self.assertTrue(c.auth_ref.project_scoped)
|
||||
self.assertFalse(c.auth_ref.domain_scoped)
|
||||
@@ -70,6 +72,7 @@ class KeystoneClientTest(utils.TestCase):
|
||||
cache = json.dumps(cl.auth_ref)
|
||||
new_client = client.Client(auth_ref=json.loads(cache))
|
||||
self.assertIsNotNone(new_client.auth_ref)
|
||||
with self.deprecations.expect_deprecations_here():
|
||||
self.assertTrue(new_client.auth_ref.scoped)
|
||||
self.assertTrue(new_client.auth_ref.project_scoped)
|
||||
self.assertFalse(new_client.auth_ref.domain_scoped)
|
||||
@@ -92,7 +95,7 @@ class KeystoneClientTest(utils.TestCase):
|
||||
new_client = client.Client(auth_ref=json.loads(cache),
|
||||
auth_url=new_auth_url)
|
||||
self.assertIsNotNone(new_client.auth_ref)
|
||||
self.assertTrue(new_client.auth_ref.scoped)
|
||||
with self.deprecations.expect_deprecations_here():
|
||||
self.assertTrue(new_client.auth_ref.scoped)
|
||||
self.assertTrue(new_client.auth_ref.project_scoped)
|
||||
self.assertFalse(new_client.auth_ref.domain_scoped)
|
||||
|
Reference in New Issue
Block a user