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