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
This commit is contained in:
wanghong
2014-11-04 18:54:59 +08:00
committed by Jamie Lennox
parent f8f81bb119
commit b7da6d0e84
3 changed files with 41 additions and 1 deletions

View File

@@ -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'),

View File

@@ -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))

View File

@@ -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))