diff options
author | Brant Knudson <bknudson@us.ibm.com> | 2015-07-24 09:10:49 -0500 |
---|---|---|
committer | Brant Knudson <bknudson@us.ibm.com> | 2015-07-24 09:14:40 -0500 |
commit | f782ee853c49dda7f86055192a01c75269e26aff (patch) | |
tree | c251bcb8c086102f3599a9aaeb77fc059351d793 | |
parent | 8d65259cb887c0a4f9c26d3994aef131633c5189 (diff) | |
download | python-keystoneclient-f782ee853c49dda7f86055192a01c75269e26aff.tar.gz |
Proper deprecation for AccessInfo scoped property
Properly deprecate constructing AccessInfo's scoped parameter.
bp deprecations
Change-Id: I8f81c75eb8e758feb9d4c62ce7f041957562e766
-rw-r--r-- | keystoneclient/access.py | 19 | ||||
-rw-r--r-- | keystoneclient/tests/unit/auth/test_identity_v3.py | 3 | ||||
-rw-r--r-- | keystoneclient/tests/unit/v2_0/test_access.py | 9 | ||||
-rw-r--r-- | keystoneclient/tests/unit/v2_0/test_client.py | 13 |
4 files changed, 34 insertions, 10 deletions
diff --git a/keystoneclient/access.py b/keystoneclient/access.py index 881f4c0..576312b 100644 --- a/keystoneclient/access.py +++ b/keystoneclient/access.py @@ -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 diff --git a/keystoneclient/tests/unit/auth/test_identity_v3.py b/keystoneclient/tests/unit/auth/test_identity_v3.py index 99062b3..8c23807 100644 --- a/keystoneclient/tests/unit/auth/test_identity_v3.py +++ b/keystoneclient/tests/unit/auth/test_identity_v3.py @@ -512,7 +512,8 @@ class V3IdentityPlugin(utils.TestCase): auth_ref = a.get_access(s) - self.assertFalse(auth_ref.scoped) + with self.deprecations.expect_deprecations_here(): + self.assertFalse(auth_ref.scoped) body = self.requests_mock.last_request.json() ident = body['auth']['identity'] diff --git a/keystoneclient/tests/unit/v2_0/test_access.py b/keystoneclient/tests/unit/v2_0/test_access.py index e966874..17b8fe4 100644 --- a/keystoneclient/tests/unit/v2_0/test_access.py +++ b/keystoneclient/tests/unit/v2_0/test_access.py @@ -48,7 +48,8 @@ class AccessInfoTest(utils.TestCase, testresources.ResourcedTestCase): self.assertIsNone(auth_ref.auth_url) self.assertIsNone(auth_ref.management_url) - self.assertFalse(auth_ref.scoped) + with self.deprecations.expect_deprecations_here(): + self.assertFalse(auth_ref.scoped) self.assertFalse(auth_ref.domain_scoped) self.assertFalse(auth_ref.project_scoped) self.assertFalse(auth_ref.trust_scoped) @@ -106,7 +107,8 @@ class AccessInfoTest(utils.TestCase, testresources.ResourcedTestCase): self.assertEqual(auth_ref.user_domain_id, 'default') self.assertEqual(auth_ref.user_domain_name, 'Default') - self.assertTrue(auth_ref.scoped) + with self.deprecations.expect_deprecations_here(): + self.assertTrue(auth_ref.scoped) self.assertTrue(auth_ref.project_scoped) self.assertFalse(auth_ref.domain_scoped) @@ -127,7 +129,8 @@ 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']) - self.assertFalse(auth_ref.scoped) + with self.deprecations.expect_deprecations_here(): + self.assertFalse(auth_ref.scoped) def test_grizzly_token(self): grizzly_token = self.examples.TOKEN_RESPONSES[ diff --git a/keystoneclient/tests/unit/v2_0/test_client.py b/keystoneclient/tests/unit/v2_0/test_client.py index 379bea4..be48e84 100644 --- a/keystoneclient/tests/unit/v2_0/test_client.py +++ b/keystoneclient/tests/unit/v2_0/test_client.py @@ -34,7 +34,8 @@ class KeystoneClientTest(utils.TestCase): password='password', auth_url=self.TEST_URL) self.assertIsNotNone(c.auth_ref) - self.assertFalse(c.auth_ref.scoped) + 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) self.assertIsNone(c.auth_ref.trust_id) @@ -51,7 +52,8 @@ class KeystoneClientTest(utils.TestCase): tenant_name='exampleproject', auth_url=self.TEST_URL) self.assertIsNotNone(c.auth_ref) - self.assertTrue(c.auth_ref.scoped) + 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) self.assertIsNone(c.auth_ref.trust_id) @@ -70,7 +72,8 @@ 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) - 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) self.assertIsNone(new_client.auth_ref.trust_id) @@ -92,8 +95,8 @@ 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) - 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) self.assertIsNone(new_client.auth_ref.trust_id) |