diff options
author | Monty Taylor <mordred@inaugust.com> | 2014-09-20 14:43:17 -0700 |
---|---|---|
committer | Craig Vyvial <cp16net@gmail.com> | 2016-05-18 13:16:25 -0500 |
commit | 7f2f18ab33f9a07525b9dc3f00cbb3dbf44fa46c (patch) | |
tree | 4abf88f0d46de5accfcc9208cd1ac14b1352d6f2 /troveclient/compat | |
parent | f7031a7e9af98fe2fb952e357155cd858d3bf440 (diff) | |
download | python-troveclient-7f2f18ab33f9a07525b9dc3f00cbb3dbf44fa46c.tar.gz |
Remove Rackspace auth references from troveclient
Removing the Rackspace Auth references that are not
supported by an openstack deployment.
Co-Authored-By: Craig Vyvial <cp16net@gmail.com>
Change-Id: I7e630a77eaeb31de0962b31bc2f86becf2975dd8
Closes-Bug: #1401804
Diffstat (limited to 'troveclient/compat')
-rw-r--r-- | troveclient/compat/auth.py | 35 | ||||
-rw-r--r-- | troveclient/compat/common.py | 4 | ||||
-rw-r--r-- | troveclient/compat/tests/test_auth.py | 51 |
3 files changed, 2 insertions, 88 deletions
diff --git a/troveclient/compat/auth.py b/troveclient/compat/auth.py index 8482fea..ed7de51 100644 --- a/troveclient/compat/auth.py +++ b/troveclient/compat/auth.py @@ -24,10 +24,6 @@ def get_authenticator_cls(cls_or_name): elif isinstance(cls_or_name, six.string_types): if cls_or_name == "keystone": return KeyStoneV2Authenticator - elif cls_or_name == "rax": - return RaxAuthenticator - elif cls_or_name == "rax2": - return RaxAuthenticator2 elif cls_or_name == "auth1.1": return Auth1_1 elif cls_or_name == "fake": @@ -133,37 +129,6 @@ class Auth1_1(Authenticator): return self._authenticate(auth_url, body, root_key='auth') -class RaxAuthenticator(Authenticator): - def authenticate(self): - if self.url is None: - raise exceptions.AuthUrlNotGiven() - return self._rax_auth(self.url) - - def _rax_auth(self, url): - """Authenticate against the Rackspace auth service.""" - body = {'auth': { - 'RAX-KSKEY:apiKeyCredentials': { - 'username': self.username, - 'apiKey': self.password, - 'tenantName': self.tenant} - } - } - - return self._authenticate(self.url, body) - - -class RaxAuthenticator2(RaxAuthenticator): - """Rax specific authenticator. - - Necessary to be able to call using the same auth url as the new client - uses for Rax auth. - """ - - def __init__(self, *args, **kwargs): - super(RaxAuthenticator2, self).__init__(*args, **kwargs) - self.url = "%s/tokens" % self.url - - class FakeAuth(Authenticator): """Useful for faking auth.""" diff --git a/troveclient/compat/common.py b/troveclient/compat/common.py index 9f8cba5..152ea77 100644 --- a/troveclient/compat/common.py +++ b/troveclient/compat/common.py @@ -161,8 +161,8 @@ class CliOptions(object): add_option("tenant_id", help="Tenant Id associated with the account.") add_option("auth_type", - help="Auth type to support different auth environments, \ - Supported values are 'keystone', 'rax'.") + help="Auth type to support different auth environments, " + "Supported value are 'keystone'.") add_option("service_type", help="Service type is a name associated for the catalog.") add_option("service_name", diff --git a/troveclient/compat/tests/test_auth.py b/troveclient/compat/tests/test_auth.py index 22b7cdf..8f6d921 100644 --- a/troveclient/compat/tests/test_auth.py +++ b/troveclient/compat/tests/test_auth.py @@ -51,7 +51,6 @@ class AuthenticatorTest(testtools.TestCase): def test_get_authenticator_cls(self): class_list = (auth.KeyStoneV2Authenticator, - auth.RaxAuthenticator, auth.Auth1_1, auth.FakeAuth) @@ -59,7 +58,6 @@ class AuthenticatorTest(testtools.TestCase): self.assertEqual(c, auth.get_authenticator_cls(c)) class_names = {"keystone": auth.KeyStoneV2Authenticator, - "rax": auth.RaxAuthenticator, "auth1.1": auth.Auth1_1, "fake": auth.FakeAuth} @@ -200,55 +198,6 @@ class Auth1_1Test(testtools.TestCase): self.assertEqual('auth', root_key) -class RaxAuthenticatorTest(testtools.TestCase): - - def test_authenticate(self): - # url is None - check_url_none(self, auth.RaxAuthenticator) - - # url is not None, so it must not throw exception - url = "test_url" - authObj = auth.RaxAuthenticator(url=url, - type=auth.RaxAuthenticator, - client=None, username=None, - password=None, tenant=None) - - def side_effect_func(url): - return url - - mock_obj = mock.Mock() - mock_obj.side_effect = side_effect_func - authObj._rax_auth = mock_obj - r = authObj.authenticate() - self.assertEqual(url, r) - - def test__rax_auth(self): - username = "trove_user" - password = "trove_password" - tenant = "tenant" - authObj = auth.RaxAuthenticator(url=None, - type=auth.RaxAuthenticator, - client=None, username=username, - password=password, tenant=tenant) - - def side_effect_func(url, body): - return body - - mock_obj = mock.Mock() - mock_obj.side_effect = side_effect_func - authObj._authenticate = mock_obj - body = authObj._rax_auth(mock.Mock()) - - v = body['auth']['RAX-KSKEY:apiKeyCredentials']['username'] - self.assertEqual(username, v) - - v = body['auth']['RAX-KSKEY:apiKeyCredentials']['apiKey'] - self.assertEqual(password, v) - - v = body['auth']['RAX-KSKEY:apiKeyCredentials']['tenantName'] - self.assertEqual(tenant, v) - - class FakeAuthTest(testtools.TestCase): def test_authenticate(self): |