Use cliff formattable columns in identity commands
Partial-Bug: #1687955 Partially implement blueprint osc-formattable-columns Change-Id: Ia13314a012b3a7363ffb24a13c79c6ecdff1ed7b
This commit is contained in:
parent
c44f26eb7e
commit
fa5046a3db
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from cliff import columns as cliff_columns
|
||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
from osc_lib import utils
|
from osc_lib import utils
|
||||||
@ -26,20 +27,21 @@ from openstackclient.i18n import _
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def _format_endpoints(eps=None):
|
class EndpointsColumn(cliff_columns.FormattableColumn):
|
||||||
if not eps:
|
def human_readable(self):
|
||||||
return ""
|
if not self._value:
|
||||||
ret = ''
|
return ""
|
||||||
for index, ep in enumerate(eps):
|
ret = ''
|
||||||
region = eps[index].get('region')
|
for ep in self._value:
|
||||||
if region is None:
|
region = ep.get('region')
|
||||||
region = '<none>'
|
if region is None:
|
||||||
ret += region + '\n'
|
region = '<none>'
|
||||||
for endpoint_type in ['publicURL', 'internalURL', 'adminURL']:
|
ret += region + '\n'
|
||||||
url = eps[index].get(endpoint_type)
|
for endpoint_type in ['publicURL', 'internalURL', 'adminURL']:
|
||||||
if url:
|
url = ep.get(endpoint_type)
|
||||||
ret += " %s: %s\n" % (endpoint_type, url)
|
if url:
|
||||||
return ret
|
ret += " %s: %s\n" % (endpoint_type, url)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
class ListCatalog(command.Lister):
|
class ListCatalog(command.Lister):
|
||||||
@ -60,7 +62,7 @@ class ListCatalog(command.Lister):
|
|||||||
(utils.get_dict_properties(
|
(utils.get_dict_properties(
|
||||||
s, columns,
|
s, columns,
|
||||||
formatters={
|
formatters={
|
||||||
'Endpoints': _format_endpoints,
|
'Endpoints': EndpointsColumn,
|
||||||
},
|
},
|
||||||
) for s in data))
|
) for s in data))
|
||||||
|
|
||||||
@ -91,7 +93,7 @@ class ShowCatalog(command.ShowOne):
|
|||||||
if (service.get('name') == parsed_args.service or
|
if (service.get('name') == parsed_args.service or
|
||||||
service.get('type') == parsed_args.service):
|
service.get('type') == parsed_args.service):
|
||||||
data = service
|
data = service
|
||||||
data['endpoints'] = _format_endpoints(data['endpoints'])
|
data['endpoints'] = EndpointsColumn(data['endpoints'])
|
||||||
if 'endpoints_links' in data:
|
if 'endpoints_links' in data:
|
||||||
data.pop('endpoints_links')
|
data.pop('endpoints_links')
|
||||||
break
|
break
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from keystoneauth1 import exceptions as ks_exc
|
from keystoneauth1 import exceptions as ks_exc
|
||||||
|
from osc_lib.cli import format_columns
|
||||||
from osc_lib.cli import parseractions
|
from osc_lib.cli import parseractions
|
||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
@ -297,7 +298,7 @@ class ShowProject(command.ShowOne):
|
|||||||
if v is not None:
|
if v is not None:
|
||||||
properties[k] = v
|
properties[k] = v
|
||||||
|
|
||||||
info['properties'] = utils.format_dict(properties)
|
info['properties'] = format_columns.DictColumn(properties)
|
||||||
return zip(*sorted(six.iteritems(info)))
|
return zip(*sorted(six.iteritems(info)))
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,8 +15,10 @@
|
|||||||
|
|
||||||
"""Identity v2.0 User action implementations"""
|
"""Identity v2.0 User action implementations"""
|
||||||
|
|
||||||
|
import functools
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from cliff import columns as cliff_columns
|
||||||
from keystoneauth1 import exceptions as ks_exc
|
from keystoneauth1 import exceptions as ks_exc
|
||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
@ -29,6 +31,31 @@ from openstackclient.i18n import _
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectColumn(cliff_columns.FormattableColumn):
|
||||||
|
"""Formattable column for project column.
|
||||||
|
|
||||||
|
Unlike the parent FormattableColumn class, the initializer of the
|
||||||
|
class takes project_cache as the second argument.
|
||||||
|
osc_lib.utils.get_item_properties instantiate cliff FormattableColumn
|
||||||
|
object with a single parameter "column value", so you need to pass
|
||||||
|
a partially initialized class like
|
||||||
|
``functools.partial(ProjectColumn, project_cache)``.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, value, project_cache=None):
|
||||||
|
super(ProjectColumn, self).__init__(value)
|
||||||
|
self.project_cache = project_cache or {}
|
||||||
|
|
||||||
|
def human_readable(self):
|
||||||
|
project = self._value
|
||||||
|
if not project:
|
||||||
|
return ""
|
||||||
|
if project in self.project_cache.keys():
|
||||||
|
return self.project_cache[project].name
|
||||||
|
else:
|
||||||
|
return project
|
||||||
|
|
||||||
|
|
||||||
class CreateUser(command.ShowOne):
|
class CreateUser(command.ShowOne):
|
||||||
_description = _("Create new user")
|
_description = _("Create new user")
|
||||||
|
|
||||||
@ -187,15 +214,7 @@ class ListUser(command.Lister):
|
|||||||
|
|
||||||
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
|
||||||
|
formatters = {}
|
||||||
def _format_project(project):
|
|
||||||
if not project:
|
|
||||||
return ""
|
|
||||||
if project in project_cache.keys():
|
|
||||||
return project_cache[project].name
|
|
||||||
else:
|
|
||||||
return project
|
|
||||||
|
|
||||||
project = None
|
project = None
|
||||||
if parsed_args.project:
|
if parsed_args.project:
|
||||||
project = utils.find_resource(
|
project = utils.find_resource(
|
||||||
@ -227,6 +246,8 @@ class ListUser(command.Lister):
|
|||||||
except Exception:
|
except Exception:
|
||||||
# Just forget it if there's any trouble
|
# Just forget it if there's any trouble
|
||||||
pass
|
pass
|
||||||
|
formatters['tenantId'] = functools.partial(
|
||||||
|
ProjectColumn, project_cache=project_cache)
|
||||||
else:
|
else:
|
||||||
columns = column_headers = ('ID', 'Name')
|
columns = column_headers = ('ID', 'Name')
|
||||||
data = identity_client.users.list(tenant_id=project)
|
data = identity_client.users.list(tenant_id=project)
|
||||||
@ -251,7 +272,7 @@ class ListUser(command.Lister):
|
|||||||
(utils.get_item_properties(
|
(utils.get_item_properties(
|
||||||
s, columns,
|
s, columns,
|
||||||
mixed_case_fields=('tenantId',),
|
mixed_case_fields=('tenantId',),
|
||||||
formatters={'tenantId': _format_project},
|
formatters=formatters,
|
||||||
) for s in data))
|
) for s in data))
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from cliff import columns as cliff_columns
|
||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
from osc_lib import utils
|
from osc_lib import utils
|
||||||
@ -26,15 +27,16 @@ from openstackclient.i18n import _
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def _format_endpoints(eps=None):
|
class EndpointsColumn(cliff_columns.FormattableColumn):
|
||||||
if not eps:
|
def human_readable(self):
|
||||||
return ""
|
if not self._value:
|
||||||
ret = ''
|
return ""
|
||||||
for ep in eps:
|
ret = ''
|
||||||
region = ep.get('region_id') or ep.get('region') or '<none>'
|
for ep in self._value:
|
||||||
ret += region + '\n'
|
region = ep.get('region_id') or ep.get('region') or '<none>'
|
||||||
ret += " %s: %s\n" % (ep['interface'], ep['url'])
|
ret += region + '\n'
|
||||||
return ret
|
ret += " %s: %s\n" % (ep['interface'], ep['url'])
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
class ListCatalog(command.Lister):
|
class ListCatalog(command.Lister):
|
||||||
@ -55,7 +57,7 @@ class ListCatalog(command.Lister):
|
|||||||
(utils.get_dict_properties(
|
(utils.get_dict_properties(
|
||||||
s, columns,
|
s, columns,
|
||||||
formatters={
|
formatters={
|
||||||
'Endpoints': _format_endpoints,
|
'Endpoints': EndpointsColumn,
|
||||||
},
|
},
|
||||||
) for s in data))
|
) for s in data))
|
||||||
|
|
||||||
@ -86,7 +88,7 @@ class ShowCatalog(command.ShowOne):
|
|||||||
if (service.get('name') == parsed_args.service or
|
if (service.get('name') == parsed_args.service or
|
||||||
service.get('type') == parsed_args.service):
|
service.get('type') == parsed_args.service):
|
||||||
data = dict(service)
|
data = dict(service)
|
||||||
data['endpoints'] = _format_endpoints(data['endpoints'])
|
data['endpoints'] = EndpointsColumn(data['endpoints'])
|
||||||
if 'links' in data:
|
if 'links' in data:
|
||||||
data.pop('links')
|
data.pop('links')
|
||||||
break
|
break
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from osc_lib.cli import format_columns
|
||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
from osc_lib import utils
|
from osc_lib import utils
|
||||||
@ -103,7 +104,7 @@ class CreateIdentityProvider(command.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', []))
|
remote_ids = format_columns.ListColumn(idp._info.pop('remote_ids', []))
|
||||||
idp._info['remote_ids'] = remote_ids
|
idp._info['remote_ids'] = remote_ids
|
||||||
return zip(*sorted(six.iteritems(idp._info)))
|
return zip(*sorted(six.iteritems(idp._info)))
|
||||||
|
|
||||||
@ -245,6 +246,6 @@ class ShowIdentityProvider(command.ShowOne):
|
|||||||
id=parsed_args.identity_provider)
|
id=parsed_args.identity_provider)
|
||||||
|
|
||||||
idp._info.pop('links', None)
|
idp._info.pop('links', None)
|
||||||
remote_ids = utils.format_list(idp._info.pop('remote_ids', []))
|
remote_ids = format_columns.ListColumn(idp._info.pop('remote_ids', []))
|
||||||
idp._info['remote_ids'] = remote_ids
|
idp._info['remote_ids'] = remote_ids
|
||||||
return zip(*sorted(six.iteritems(idp._info)))
|
return zip(*sorted(six.iteritems(idp._info)))
|
||||||
|
@ -71,17 +71,9 @@ class TestCatalogList(TestCatalog):
|
|||||||
datalist = ((
|
datalist = ((
|
||||||
'supernova',
|
'supernova',
|
||||||
'compute',
|
'compute',
|
||||||
'one\n publicURL: https://public.one.example.com\n '
|
catalog.EndpointsColumn(self.service_catalog['endpoints']),
|
||||||
'internalURL: https://internal.one.example.com\n '
|
|
||||||
'adminURL: https://admin.one.example.com\n'
|
|
||||||
'two\n publicURL: https://public.two.example.com\n '
|
|
||||||
'internalURL: https://internal.two.example.com\n '
|
|
||||||
'adminURL: https://admin.two.example.com\n'
|
|
||||||
'<none>\n publicURL: https://public.none.example.com\n '
|
|
||||||
'internalURL: https://internal.none.example.com\n '
|
|
||||||
'adminURL: https://admin.none.example.com\n',
|
|
||||||
), )
|
), )
|
||||||
self.assertEqual(datalist, tuple(data))
|
self.assertListItemEqual(datalist, tuple(data))
|
||||||
|
|
||||||
def test_catalog_list_with_endpoint_url(self):
|
def test_catalog_list_with_endpoint_url(self):
|
||||||
attr = {
|
attr = {
|
||||||
@ -121,11 +113,9 @@ class TestCatalogList(TestCatalog):
|
|||||||
datalist = ((
|
datalist = ((
|
||||||
'supernova',
|
'supernova',
|
||||||
'compute',
|
'compute',
|
||||||
'one\n publicURL: https://public.one.example.com\n'
|
catalog.EndpointsColumn(service_catalog['endpoints']),
|
||||||
'two\n publicURL: https://public.two.example.com\n '
|
|
||||||
'internalURL: https://internal.two.example.com\n'
|
|
||||||
), )
|
), )
|
||||||
self.assertEqual(datalist, tuple(data))
|
self.assertListItemEqual(datalist, tuple(data))
|
||||||
|
|
||||||
|
|
||||||
class TestCatalogShow(TestCatalog):
|
class TestCatalogShow(TestCatalog):
|
||||||
@ -160,6 +150,18 @@ class TestCatalogShow(TestCatalog):
|
|||||||
collist = ('endpoints', 'id', 'name', 'type')
|
collist = ('endpoints', 'id', 'name', 'type')
|
||||||
self.assertEqual(collist, columns)
|
self.assertEqual(collist, columns)
|
||||||
datalist = (
|
datalist = (
|
||||||
|
catalog.EndpointsColumn(self.service_catalog['endpoints']),
|
||||||
|
self.service_catalog.id,
|
||||||
|
'supernova',
|
||||||
|
'compute',
|
||||||
|
)
|
||||||
|
self.assertItemEqual(datalist, data)
|
||||||
|
|
||||||
|
|
||||||
|
class TestFormatColumns(TestCatalog):
|
||||||
|
def test_endpoints_column_human_readabale(self):
|
||||||
|
col = catalog.EndpointsColumn(self.service_catalog['endpoints'])
|
||||||
|
self.assertEqual(
|
||||||
'one\n publicURL: https://public.one.example.com\n '
|
'one\n publicURL: https://public.one.example.com\n '
|
||||||
'internalURL: https://internal.one.example.com\n '
|
'internalURL: https://internal.one.example.com\n '
|
||||||
'adminURL: https://admin.one.example.com\n'
|
'adminURL: https://admin.one.example.com\n'
|
||||||
@ -169,8 +171,23 @@ class TestCatalogShow(TestCatalog):
|
|||||||
'<none>\n publicURL: https://public.none.example.com\n '
|
'<none>\n publicURL: https://public.none.example.com\n '
|
||||||
'internalURL: https://internal.none.example.com\n '
|
'internalURL: https://internal.none.example.com\n '
|
||||||
'adminURL: https://admin.none.example.com\n',
|
'adminURL: https://admin.none.example.com\n',
|
||||||
self.service_catalog.id,
|
col.human_readable())
|
||||||
'supernova',
|
|
||||||
'compute',
|
def test_endpoints_column_human_readable_with_partial_endpoint_urls(self):
|
||||||
)
|
endpoints = [
|
||||||
self.assertEqual(datalist, data)
|
{
|
||||||
|
'region': 'one',
|
||||||
|
'publicURL': 'https://public.one.example.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'region': 'two',
|
||||||
|
'publicURL': 'https://public.two.example.com',
|
||||||
|
'internalURL': 'https://internal.two.example.com',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
col = catalog.EndpointsColumn(endpoints)
|
||||||
|
self.assertEqual(
|
||||||
|
'one\n publicURL: https://public.one.example.com\n'
|
||||||
|
'two\n publicURL: https://public.two.example.com\n '
|
||||||
|
'internalURL: https://internal.two.example.com\n',
|
||||||
|
col.human_readable())
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
import mock
|
import mock
|
||||||
|
|
||||||
from keystoneauth1 import exceptions as ks_exc
|
from keystoneauth1 import exceptions as ks_exc
|
||||||
|
from osc_lib.cli import format_columns
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
from osc_lib import utils
|
from osc_lib import utils
|
||||||
|
|
||||||
@ -640,9 +641,9 @@ class TestProjectShow(TestProject):
|
|||||||
True,
|
True,
|
||||||
self.fake_proj_show.id,
|
self.fake_proj_show.id,
|
||||||
self.fake_proj_show.name,
|
self.fake_proj_show.name,
|
||||||
'',
|
format_columns.DictColumn({}),
|
||||||
)
|
)
|
||||||
self.assertEqual(datalist, data)
|
self.assertItemEqual(datalist, data)
|
||||||
|
|
||||||
|
|
||||||
class TestProjectUnset(TestProject):
|
class TestProjectUnset(TestProject):
|
||||||
|
@ -482,7 +482,7 @@ class TestUserList(TestUser):
|
|||||||
self.users_mock.list.assert_called_with(tenant_id=None)
|
self.users_mock.list.assert_called_with(tenant_id=None)
|
||||||
|
|
||||||
self.assertEqual(self.columns, columns)
|
self.assertEqual(self.columns, columns)
|
||||||
self.assertEqual(self.datalist, tuple(data))
|
self.assertListItemEqual(self.datalist, tuple(data))
|
||||||
|
|
||||||
def test_user_list_project(self):
|
def test_user_list_project(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
@ -502,7 +502,7 @@ class TestUserList(TestUser):
|
|||||||
self.users_mock.list.assert_called_with(tenant_id=project_id)
|
self.users_mock.list.assert_called_with(tenant_id=project_id)
|
||||||
|
|
||||||
self.assertEqual(self.columns, columns)
|
self.assertEqual(self.columns, columns)
|
||||||
self.assertEqual(self.datalist, tuple(data))
|
self.assertListItemEqual(self.datalist, tuple(data))
|
||||||
|
|
||||||
def test_user_list_long(self):
|
def test_user_list_long(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
@ -525,11 +525,13 @@ class TestUserList(TestUser):
|
|||||||
datalist = ((
|
datalist = ((
|
||||||
self.fake_user_l.id,
|
self.fake_user_l.id,
|
||||||
self.fake_user_l.name,
|
self.fake_user_l.name,
|
||||||
self.fake_project_l.name,
|
user.ProjectColumn(
|
||||||
|
self.fake_project_l.id,
|
||||||
|
{self.fake_project_l.id: self.fake_project_l}),
|
||||||
self.fake_user_l.email,
|
self.fake_user_l.email,
|
||||||
True,
|
True,
|
||||||
), )
|
), )
|
||||||
self.assertEqual(datalist, tuple(data))
|
self.assertListItemEqual(datalist, tuple(data))
|
||||||
|
|
||||||
|
|
||||||
class TestUserSet(TestUser):
|
class TestUserSet(TestUser):
|
||||||
@ -817,4 +819,4 @@ class TestUserShow(TestUser):
|
|||||||
self.fake_user.name,
|
self.fake_user.name,
|
||||||
self.fake_project.id,
|
self.fake_project.id,
|
||||||
)
|
)
|
||||||
self.assertEqual(datalist, data)
|
self.assertItemEqual(datalist, data)
|
||||||
|
@ -20,6 +20,7 @@ import uuid
|
|||||||
from keystoneauth1 import access
|
from keystoneauth1 import access
|
||||||
from keystoneauth1 import fixture
|
from keystoneauth1 import fixture
|
||||||
import mock
|
import mock
|
||||||
|
from osc_lib.cli import format_columns
|
||||||
|
|
||||||
from openstackclient.tests.unit import fakes
|
from openstackclient.tests.unit import fakes
|
||||||
from openstackclient.tests.unit import utils
|
from openstackclient.tests.unit import utils
|
||||||
@ -300,7 +301,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'
|
formatted_idp_remote_ids = format_columns.ListColumn(idp_remote_ids)
|
||||||
|
|
||||||
IDENTITY_PROVIDER = {
|
IDENTITY_PROVIDER = {
|
||||||
'id': idp_id,
|
'id': idp_id,
|
||||||
|
@ -91,12 +91,9 @@ class TestCatalogList(TestCatalog):
|
|||||||
datalist = ((
|
datalist = ((
|
||||||
'supernova',
|
'supernova',
|
||||||
'compute',
|
'compute',
|
||||||
'onlyone\n public: https://public.example.com\n'
|
catalog.EndpointsColumn(self.fake_service['endpoints']),
|
||||||
'onlyone\n admin: https://admin.example.com\n'
|
|
||||||
'<none>\n internal: https://internal.example.com\n'
|
|
||||||
'<none>\n none: https://none.example.com\n',
|
|
||||||
), )
|
), )
|
||||||
self.assertEqual(datalist, tuple(data))
|
self.assertListItemEqual(datalist, tuple(data))
|
||||||
|
|
||||||
|
|
||||||
class TestCatalogShow(TestCatalog):
|
class TestCatalogShow(TestCatalog):
|
||||||
@ -131,12 +128,20 @@ class TestCatalogShow(TestCatalog):
|
|||||||
collist = ('endpoints', 'id', 'name', 'type')
|
collist = ('endpoints', 'id', 'name', 'type')
|
||||||
self.assertEqual(collist, columns)
|
self.assertEqual(collist, columns)
|
||||||
datalist = (
|
datalist = (
|
||||||
'onlyone\n public: https://public.example.com\nonlyone\n'
|
catalog.EndpointsColumn(self.fake_service['endpoints']),
|
||||||
' admin: https://admin.example.com\n'
|
|
||||||
'<none>\n internal: https://internal.example.com\n'
|
|
||||||
'<none>\n none: https://none.example.com\n',
|
|
||||||
'qwertyuiop',
|
'qwertyuiop',
|
||||||
'supernova',
|
'supernova',
|
||||||
'compute',
|
'compute',
|
||||||
)
|
)
|
||||||
self.assertEqual(datalist, data)
|
self.assertItemEqual(datalist, data)
|
||||||
|
|
||||||
|
|
||||||
|
class TestFormatColumns(TestCatalog):
|
||||||
|
def test_endpoints_column_human_readabale(self):
|
||||||
|
col = catalog.EndpointsColumn(self.fake_service['endpoints'])
|
||||||
|
self.assertEqual(
|
||||||
|
'onlyone\n public: https://public.example.com\n'
|
||||||
|
'onlyone\n admin: https://admin.example.com\n'
|
||||||
|
'<none>\n internal: https://internal.example.com\n'
|
||||||
|
'<none>\n none: https://none.example.com\n',
|
||||||
|
col.human_readable())
|
||||||
|
@ -90,7 +90,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(self.columns, columns)
|
self.assertEqual(self.columns, columns)
|
||||||
self.assertEqual(self.datalist, data)
|
self.assertItemEqual(self.datalist, data)
|
||||||
|
|
||||||
def test_create_identity_provider_description(self):
|
def test_create_identity_provider_description(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
@ -118,7 +118,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(self.columns, columns)
|
self.assertEqual(self.columns, columns)
|
||||||
self.assertEqual(self.datalist, data)
|
self.assertItemEqual(self.datalist, data)
|
||||||
|
|
||||||
def test_create_identity_provider_remote_id(self):
|
def test_create_identity_provider_remote_id(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
@ -146,7 +146,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(self.columns, columns)
|
self.assertEqual(self.columns, columns)
|
||||||
self.assertEqual(self.datalist, data)
|
self.assertItemEqual(self.datalist, data)
|
||||||
|
|
||||||
def test_create_identity_provider_remote_ids_multiple(self):
|
def test_create_identity_provider_remote_ids_multiple(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
@ -175,7 +175,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(self.columns, columns)
|
self.assertEqual(self.columns, columns)
|
||||||
self.assertEqual(self.datalist, data)
|
self.assertItemEqual(self.datalist, data)
|
||||||
|
|
||||||
def test_create_identity_provider_remote_ids_file(self):
|
def test_create_identity_provider_remote_ids_file(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
@ -208,7 +208,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(self.columns, columns)
|
self.assertEqual(self.columns, columns)
|
||||||
self.assertEqual(self.datalist, data)
|
self.assertItemEqual(self.datalist, data)
|
||||||
|
|
||||||
def test_create_identity_provider_disabled(self):
|
def test_create_identity_provider_disabled(self):
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
|
|||||||
identity_fakes.idp_id,
|
identity_fakes.idp_id,
|
||||||
identity_fakes.formatted_idp_remote_ids
|
identity_fakes.formatted_idp_remote_ids
|
||||||
)
|
)
|
||||||
self.assertEqual(datalist, data)
|
self.assertItemEqual(datalist, data)
|
||||||
|
|
||||||
def test_create_identity_provider_domain_name(self):
|
def test_create_identity_provider_domain_name(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
@ -279,7 +279,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(self.columns, columns)
|
self.assertEqual(self.columns, columns)
|
||||||
self.assertEqual(self.datalist, data)
|
self.assertItemEqual(self.datalist, data)
|
||||||
|
|
||||||
def test_create_identity_provider_domain_id(self):
|
def test_create_identity_provider_domain_id(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
@ -307,7 +307,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(self.columns, columns)
|
self.assertEqual(self.columns, columns)
|
||||||
self.assertEqual(self.datalist, data)
|
self.assertItemEqual(self.datalist, data)
|
||||||
|
|
||||||
|
|
||||||
class TestIdentityProviderDelete(TestIdentityProvider):
|
class TestIdentityProviderDelete(TestIdentityProvider):
|
||||||
@ -383,7 +383,7 @@ class TestIdentityProviderList(TestIdentityProvider):
|
|||||||
identity_fakes.domain_id,
|
identity_fakes.domain_id,
|
||||||
identity_fakes.idp_description,
|
identity_fakes.idp_description,
|
||||||
), )
|
), )
|
||||||
self.assertEqual(datalist, tuple(data))
|
self.assertListItemEqual(datalist, tuple(data))
|
||||||
|
|
||||||
|
|
||||||
class TestIdentityProviderSet(TestIdentityProvider):
|
class TestIdentityProviderSet(TestIdentityProvider):
|
||||||
@ -668,4 +668,4 @@ class TestIdentityProviderShow(TestIdentityProvider):
|
|||||||
identity_fakes.idp_id,
|
identity_fakes.idp_id,
|
||||||
identity_fakes.formatted_idp_remote_ids
|
identity_fakes.formatted_idp_remote_ids
|
||||||
)
|
)
|
||||||
self.assertEqual(datalist, data)
|
self.assertItemEqual(datalist, data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user