Merge "Fix IDP commands"
This commit is contained in:
commit
4d3d287dd7
@ -61,8 +61,8 @@ class CreateIdentityProvider(show.ShowOne):
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('take_action(%s)', parsed_args)
|
||||
identity_client = self.app.client_manager.identity
|
||||
idp = identity_client.identity_providers.create(
|
||||
parsed_args.identity_provider_id,
|
||||
idp = identity_client.federation.identity_providers.create(
|
||||
id=parsed_args.identity_provider_id,
|
||||
description=parsed_args.description,
|
||||
enabled=parsed_args.enabled)
|
||||
info = {}
|
||||
@ -87,7 +87,7 @@ class DeleteIdentityProvider(command.Command):
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('take_action(%s)', parsed_args)
|
||||
identity_client = self.app.client_manager.identity
|
||||
identity_client.identity_providers.delete(
|
||||
identity_client.federation.identity_providers.delete(
|
||||
parsed_args.identity_provider)
|
||||
return
|
||||
|
||||
@ -100,7 +100,8 @@ class ListIdentityProvider(lister.Lister):
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('take_action(%s)', parsed_args)
|
||||
columns = ('ID', 'Enabled', 'Description')
|
||||
data = self.app.client_manager.identity.identity_providers.list()
|
||||
identity_client = self.app.client_manager.identity
|
||||
data = identity_client.federation.identity_providers.list()
|
||||
return (columns,
|
||||
(utils.get_item_properties(
|
||||
s, columns,
|
||||
@ -136,7 +137,7 @@ class SetIdentityProvider(command.Command):
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('take_action(%s)', parsed_args)
|
||||
identity_client = self.app.client_manager.identity
|
||||
federation_client = self.app.client_manager.identity.federation
|
||||
|
||||
if parsed_args.enable is True:
|
||||
enabled = True
|
||||
@ -147,7 +148,7 @@ class SetIdentityProvider(command.Command):
|
||||
"no arguments present")
|
||||
return (None, None)
|
||||
|
||||
identity_provider = identity_client.identity_providers.update(
|
||||
identity_provider = federation_client.identity_providers.update(
|
||||
parsed_args.identity_provider, enabled=enabled)
|
||||
info = {}
|
||||
info.update(identity_provider._info)
|
||||
@ -172,7 +173,7 @@ class ShowIdentityProvider(show.ShowOne):
|
||||
self.log.debug('take_action(%s)', parsed_args)
|
||||
identity_client = self.app.client_manager.identity
|
||||
identity_provider = utils.find_resource(
|
||||
identity_client.identity_providers,
|
||||
identity_client.federation.identity_providers,
|
||||
parsed_args.identity_provider)
|
||||
|
||||
info = {}
|
||||
|
@ -201,12 +201,16 @@ class FakeIdentityv3Client(object):
|
||||
self.management_url = kwargs['endpoint']
|
||||
|
||||
|
||||
class FakeFederationManager(object):
|
||||
def __init__(self, **kwargs):
|
||||
self.identity_providers = mock.Mock()
|
||||
self.identity_providers.resource_class = fakes.FakeResource(None, {})
|
||||
|
||||
|
||||
class FakeFederatedClient(FakeIdentityv3Client):
|
||||
def __init__(self, **kwargs):
|
||||
super(FakeFederatedClient, self).__init__(**kwargs)
|
||||
|
||||
self.identity_providers = mock.Mock()
|
||||
self.identity_providers.resource_class = fakes.FakeResource(None, {})
|
||||
self.federation = FakeFederationManager()
|
||||
|
||||
|
||||
class FakeOAuth1Client(FakeIdentityv3Client):
|
||||
|
@ -24,8 +24,8 @@ class TestIdentityProvider(identity_fakes.TestFederatedIdentity):
|
||||
def setUp(self):
|
||||
super(TestIdentityProvider, self).setUp()
|
||||
|
||||
identity_lib = self.app.client_manager.identity
|
||||
self.identity_providers_mock = identity_lib.identity_providers
|
||||
federation_lib = self.app.client_manager.identity.federation
|
||||
self.identity_providers_mock = federation_lib.identity_providers
|
||||
self.identity_providers_mock.reset_mock()
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
|
||||
}
|
||||
|
||||
self.identity_providers_mock.create.assert_called_with(
|
||||
identity_fakes.idp_id,
|
||||
id=identity_fakes.idp_id,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
@ -88,7 +88,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
|
||||
}
|
||||
|
||||
self.identity_providers_mock.create.assert_called_with(
|
||||
identity_fakes.idp_id,
|
||||
id=identity_fakes.idp_id,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
@ -128,7 +128,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
|
||||
}
|
||||
|
||||
self.identity_providers_mock.create.assert_called_with(
|
||||
identity_fakes.idp_id,
|
||||
id=identity_fakes.idp_id,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
@ -217,12 +217,12 @@ class TestIdentityProviderShow(TestIdentityProvider):
|
||||
def setUp(self):
|
||||
super(TestIdentityProviderShow, self).setUp()
|
||||
|
||||
self.identity_providers_mock.get.return_value = fakes.FakeResource(
|
||||
ret = fakes.FakeResource(
|
||||
None,
|
||||
copy.deepcopy(identity_fakes.IDENTITY_PROVIDER),
|
||||
loaded=True,
|
||||
)
|
||||
|
||||
self.identity_providers_mock.get.return_value = ret
|
||||
# Get the command object to test
|
||||
self.cmd = identity_provider.ShowIdentityProvider(self.app, None)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user