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)
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)))
@ -230,9 +232,11 @@ class ShowIdentityProvider(show.ShowOne):
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
identity_provider = utils.find_resource(
idp = utils.find_resource(
identity_client.federation.identity_providers,
parsed_args.identity_provider)
identity_provider._info.pop('links', None)
return zip(*sorted(six.iteritems(identity_provider._info)))
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)))

View File

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

View File

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