[RBAC] Add share group type tests
The tests validate policy of share group type actions
for admin, member and reader users in a project scope.
Change-Id: I759fe2b5048aea466cab9107cca68d70548bd347
diff --git a/manila_tempest_tests/tests/rbac/base.py b/manila_tempest_tests/tests/rbac/base.py
index 5aaf35e..b5ff355 100644
--- a/manila_tempest_tests/tests/rbac/base.py
+++ b/manila_tempest_tests/tests/rbac/base.py
@@ -53,7 +53,7 @@
'sn': 'share_network',
}
key, resource_id = list(kwargs.items())[0]
- key = key.split('_')[0]
+ key = key.rsplit('_', 1)[0]
resource_name = key_names[key] if key in key_names else key
del_action = getattr(client, 'delete_{}'.format(resource_name))
@@ -115,6 +115,19 @@
return share_type
@classmethod
+ def create_share_group_type(cls, share_types, is_public=True,
+ group_specs=None):
+ name = data_utils.rand_name('share-group-type')
+ share_group_type = (
+ cls.admin_shares_v2_client.create_share_group_type(
+ name=name, share_types=share_types, is_public=is_public,
+ group_specs=group_specs))['share_group_type']
+ cls.addClassResourceCleanup(
+ cls.delete_resource, cls.admin_shares_v2_client,
+ share_group_type_id=share_group_type['id'])
+ return share_group_type
+
+ @classmethod
def get_share_type(cls):
return cls.shares_v2_client.get_default_share_type()['share_type']