Merge "better format remote IDs for identity providers"

This commit is contained in:
Jenkins 2015-11-15 01:24:47 +00:00 committed by Gerrit Code Review
commit 6952916c48
3 changed files with 15 additions and 10 deletions

View File

@ -88,6 +88,8 @@ class CreateIdentityProvider(show.ShowOne):
enabled=parsed_args.enabled) enabled=parsed_args.enabled)
idp._info.pop('links', None) idp._info.pop('links', None)
remote_ids = utils.format_list(idp._info.pop('remote_ids', []))
idp._info['remote_ids'] = remote_ids
return zip(*sorted(six.iteritems(idp._info))) return zip(*sorted(six.iteritems(idp._info)))
@ -230,9 +232,11 @@ class ShowIdentityProvider(show.ShowOne):
@utils.log_method(log) @utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
identity_provider = utils.find_resource( idp = utils.find_resource(
identity_client.federation.identity_providers, identity_client.federation.identity_providers,
parsed_args.identity_provider) parsed_args.identity_provider)
identity_provider._info.pop('links', None) idp._info.pop('links', None)
return zip(*sorted(six.iteritems(identity_provider._info))) remote_ids = utils.format_list(idp._info.pop('remote_ids', []))
idp._info['remote_ids'] = remote_ids
return zip(*sorted(six.iteritems(idp._info)))

View File

@ -261,6 +261,7 @@ TOKEN_WITH_DOMAIN_ID = {
idp_id = 'test_idp' idp_id = 'test_idp'
idp_description = 'super exciting IdP description' idp_description = 'super exciting IdP description'
idp_remote_ids = ['entity1', 'entity2'] idp_remote_ids = ['entity1', 'entity2']
formatted_idp_remote_ids = 'entity1, entity2'
IDENTITY_PROVIDER = { IDENTITY_PROVIDER = {
'id': idp_id, 'id': idp_id,

View File

@ -69,7 +69,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
identity_fakes.idp_description, identity_fakes.idp_description,
True, True,
identity_fakes.idp_id, identity_fakes.idp_id,
identity_fakes.idp_remote_ids identity_fakes.formatted_idp_remote_ids
) )
self.assertEqual(datalist, data) self.assertEqual(datalist, data)
@ -103,7 +103,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
identity_fakes.idp_description, identity_fakes.idp_description,
True, True,
identity_fakes.idp_id, identity_fakes.idp_id,
identity_fakes.idp_remote_ids identity_fakes.formatted_idp_remote_ids
) )
self.assertEqual(datalist, data) self.assertEqual(datalist, data)
@ -137,7 +137,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
identity_fakes.idp_description, identity_fakes.idp_description,
True, True,
identity_fakes.idp_id, identity_fakes.idp_id,
identity_fakes.idp_remote_ids identity_fakes.formatted_idp_remote_ids
) )
self.assertEqual(datalist, data) self.assertEqual(datalist, data)
@ -172,7 +172,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
identity_fakes.idp_description, identity_fakes.idp_description,
True, True,
identity_fakes.idp_id, identity_fakes.idp_id,
identity_fakes.idp_remote_ids identity_fakes.formatted_idp_remote_ids
) )
self.assertEqual(datalist, data) self.assertEqual(datalist, data)
@ -211,7 +211,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
identity_fakes.idp_description, identity_fakes.idp_description,
True, True,
identity_fakes.idp_id, identity_fakes.idp_id,
identity_fakes.idp_remote_ids identity_fakes.formatted_idp_remote_ids
) )
self.assertEqual(datalist, data) self.assertEqual(datalist, data)
@ -253,7 +253,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
None, None,
False, False,
identity_fakes.idp_id, identity_fakes.idp_id,
identity_fakes.idp_remote_ids identity_fakes.formatted_idp_remote_ids
) )
self.assertEqual(datalist, data) self.assertEqual(datalist, data)
@ -363,7 +363,7 @@ class TestIdentityProviderShow(TestIdentityProvider):
identity_fakes.idp_description, identity_fakes.idp_description,
True, True,
identity_fakes.idp_id, identity_fakes.idp_id,
identity_fakes.idp_remote_ids identity_fakes.formatted_idp_remote_ids
) )
self.assertEqual(datalist, data) self.assertEqual(datalist, data)