From b7da6d0e8449355fa7652523ee5ad0b36b298399 Mon Sep 17 00:00:00 2001 From: wanghong Date: Tue, 4 Nov 2014 18:54:59 +0800 Subject: [PATCH] duplicate auth-url option returned by BaseGenericPlugin The free function get_options() should only return the options that the object itself needs. Change-Id: Id54f353d8b125807a8fc33b4bca8854605e3febb Closes-Bug: #1388954 --- keystoneclient/auth/identity/generic/base.py | 2 +- keystoneclient/tests/auth/test_password.py | 22 ++++++++++++++++++++ keystoneclient/tests/auth/test_token.py | 18 ++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/keystoneclient/auth/identity/generic/base.py b/keystoneclient/auth/identity/generic/base.py index 631eebdad..6b1aceb35 100644 --- a/keystoneclient/auth/identity/generic/base.py +++ b/keystoneclient/auth/identity/generic/base.py @@ -27,7 +27,7 @@ LOG = logging.getLogger(__name__) def get_options(): - return base.get_options() + [ + return [ cfg.StrOpt('domain-id', help='Domain ID to scope to'), cfg.StrOpt('domain-name', help='Domain name to scope to'), cfg.StrOpt('tenant-id', help='Tenant ID to scope to'), diff --git a/keystoneclient/tests/auth/test_password.py b/keystoneclient/tests/auth/test_password.py index 5c9386493..c08e69de3 100644 --- a/keystoneclient/tests/auth/test_password.py +++ b/keystoneclient/tests/auth/test_password.py @@ -38,3 +38,25 @@ class PasswordTests(utils.GenericPluginTestCase): def test_v3_user_params_v2_url(self): self.stub_discovery(v3=False) self.assertDiscoveryFailure(user_domain_id=uuid.uuid4().hex) + + def test_options(self): + opts = [o.name for o in self.PLUGIN_CLASS.get_options()] + + allowed_opts = ['user-name', + 'user-domain-id', + 'user-domain-name', + 'password', + + 'domain-id', + 'domain-name', + 'tenant-id', + 'tenant-name', + 'project-id', + 'project-name', + 'project-domain-id', + 'project-domain-name', + 'trust-id', + 'auth-url'] + + self.assertEqual(set(allowed_opts), set(opts)) + self.assertEqual(len(allowed_opts), len(opts)) diff --git a/keystoneclient/tests/auth/test_token.py b/keystoneclient/tests/auth/test_token.py index d9a11e097..9f0cc3c7f 100644 --- a/keystoneclient/tests/auth/test_token.py +++ b/keystoneclient/tests/auth/test_token.py @@ -27,3 +27,21 @@ class TokenTests(utils.GenericPluginTestCase): def new_plugin(self, **kwargs): kwargs.setdefault('token', uuid.uuid4().hex) return super(TokenTests, self).new_plugin(**kwargs) + + def test_options(self): + opts = [o.name for o in self.PLUGIN_CLASS.get_options()] + + allowed_opts = ['token', + 'domain-id', + 'domain-name', + 'tenant-id', + 'tenant-name', + 'project-id', + 'project-name', + 'project-domain-id', + 'project-domain-name', + 'trust-id', + 'auth-url'] + + self.assertEqual(set(allowed_opts), set(opts)) + self.assertEqual(len(allowed_opts), len(opts))