Merge "API for list group types by parameter sort/public"
This commit is contained in:
commit
fb108e1957
|
@ -71,3 +71,39 @@ class GroupTypesTest(base.BaseVolumeAdminTest):
|
|||
self.admin_group_types_client.list_group_types()['group_types'])
|
||||
group_ids = [it['id'] for it in group_list]
|
||||
self.assertNotIn(body['id'], group_ids)
|
||||
|
||||
@decorators.idempotent_id('3d5e5cec-72b4-4511-b135-7cc2b7a053ae')
|
||||
def test_group_type_list_by_optional_params(self):
|
||||
"""Test list group type sort/public"""
|
||||
type_a_name = "a_{}".format(data_utils.rand_name('group-type'))
|
||||
type_b_name = "b_{}".format(data_utils.rand_name('group-type'))
|
||||
self.create_group_type(name=type_a_name, **{'is_public': True})
|
||||
self.create_group_type(name=type_b_name, **{'is_public': False})
|
||||
|
||||
group_list = (
|
||||
self.admin_group_types_client.list_group_types(
|
||||
sort="name:asc", is_public=None)['group_types'])
|
||||
name_list = [it['name'] for it in group_list]
|
||||
self.assertLess(
|
||||
name_list.index(type_a_name), name_list.index(type_b_name))
|
||||
|
||||
group_list = (
|
||||
self.admin_group_types_client.list_group_types(
|
||||
sort="name:desc", is_public=None)['group_types'])
|
||||
name_list = [it['name'] for it in group_list]
|
||||
self.assertLess(name_list.index(type_b_name),
|
||||
name_list.index(type_a_name))
|
||||
|
||||
group_list = (
|
||||
self.admin_group_types_client.list_group_types(
|
||||
is_public=False)['group_types'])
|
||||
name_list = [it['name'] for it in group_list]
|
||||
self.assertNotIn(type_a_name, name_list)
|
||||
self.assertIn(type_b_name, name_list)
|
||||
|
||||
group_list = (
|
||||
self.admin_group_types_client.list_group_types(
|
||||
is_public=True)['group_types'])
|
||||
name_list = [it['name'] for it in group_list]
|
||||
self.assertNotIn(type_b_name, name_list)
|
||||
self.assertIn(type_a_name, name_list)
|
||||
|
|
Loading…
Reference in New Issue