Merge "[V3] Make groups_client use **kwargs"
diff --git a/tempest/api/identity/admin/v3/test_groups.py b/tempest/api/identity/admin/v3/test_groups.py
index d5af4b4..f25ed98 100644
--- a/tempest/api/identity/admin/v3/test_groups.py
+++ b/tempest/api/identity/admin/v3/test_groups.py
@@ -25,7 +25,7 @@
name = data_utils.rand_name('Group')
description = data_utils.rand_name('Description')
group = self.groups_client.create_group(
- name, description=description)['group']
+ name=name, description=description)['group']
self.addCleanup(self.groups_client.delete_group, group['id'])
self.assertEqual(group['name'], name)
self.assertEqual(group['description'], description)
@@ -46,7 +46,7 @@
@test.idempotent_id('1598521a-2f36-4606-8df9-30772bd51339')
def test_group_users_add_list_delete(self):
name = data_utils.rand_name('Group')
- group = self.groups_client.create_group(name)['group']
+ group = self.groups_client.create_group(name=name)['group']
self.addCleanup(self.groups_client.delete_group, group['id'])
# add user into group
users = []
@@ -77,7 +77,7 @@
groups = []
for i in range(2):
name = data_utils.rand_name('Group')
- group = self.groups_client.create_group(name)['group']
+ group = self.groups_client.create_group(name=name)['group']
groups.append(group)
self.addCleanup(self.groups_client.delete_group, group['id'])
self.groups_client.add_group_user(group['id'], user['id'])
@@ -95,7 +95,7 @@
name = data_utils.rand_name('Group')
description = data_utils.rand_name('Description')
group = self.groups_client.create_group(
- name, description=description)['group']
+ name=name, description=description)['group']
self.addCleanup(self.groups_client.delete_group, group['id'])
group_ids.append(group['id'])
# List and Verify Groups
diff --git a/tempest/api/identity/admin/v3/test_roles.py b/tempest/api/identity/admin/v3/test_roles.py
index d5350a1..3be2643 100644
--- a/tempest/api/identity/admin/v3/test_roles.py
+++ b/tempest/api/identity/admin/v3/test_roles.py
@@ -40,7 +40,7 @@
description=data_utils.rand_name('project-desc'),
domain_id=cls.domain['id'])['project']
cls.group_body = cls.groups_client.create_group(
- data_utils.rand_name('Group'), project_id=cls.project['id'],
+ name=data_utils.rand_name('Group'), project_id=cls.project['id'],
domain_id=cls.domain['id'])['group']
cls.user_body = cls.client.create_user(
u_name, description=u_desc, password=cls.u_password,
diff --git a/tempest/services/identity/v3/json/groups_client.py b/tempest/services/identity/v3/json/groups_client.py
index 5bd610d..2f302ae 100644
--- a/tempest/services/identity/v3/json/groups_client.py
+++ b/tempest/services/identity/v3/json/groups_client.py
@@ -13,6 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+"""
+http://developer.openstack.org/api-ref-identity-v3.html#groups-v3
+"""
+
from oslo_serialization import jsonutils as json
from tempest.common import service_client
@@ -21,18 +25,13 @@
class GroupsClient(service_client.ServiceClient):
api_version = "v3"
- def create_group(self, name, **kwargs):
- """Creates a group."""
- description = kwargs.get('description', None)
- domain_id = kwargs.get('domain_id', 'default')
- project_id = kwargs.get('project_id', None)
- post_body = {
- 'description': description,
- 'domain_id': domain_id,
- 'project_id': project_id,
- 'name': name
- }
- post_body = json.dumps({'group': post_body})
+ def create_group(self, **kwargs):
+ """Creates a group.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-identity-v3.html#createGroup
+ """
+ post_body = json.dumps({'group': kwargs})
resp, body = self.post('groups', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
@@ -53,15 +52,12 @@
return service_client.ResponseBody(resp, body)
def update_group(self, group_id, **kwargs):
- """Updates a group."""
- body = self.get_group(group_id)['group']
- name = kwargs.get('name', body['name'])
- description = kwargs.get('description', body['description'])
- post_body = {
- 'name': name,
- 'description': description
- }
- post_body = json.dumps({'group': post_body})
+ """Updates a group.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-identity-v3.html#updateGroup
+ """
+ post_body = json.dumps({'group': kwargs})
resp, body = self.patch('groups/%s' % group_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)