diff --git a/tempest/api/identity/admin/v3/test_endpoints.py b/tempest/api/identity/admin/v3/test_endpoints.py index 2fd7369ed4..429e2e3dc6 100644 --- a/tempest/api/identity/admin/v3/test_endpoints.py +++ b/tempest/api/identity/admin/v3/test_endpoints.py @@ -33,9 +33,9 @@ class EndPointsTestJSON(base.BaseIdentityV3AdminTest): s_name = data_utils.rand_name('service') s_type = data_utils.rand_name('type') s_description = data_utils.rand_name('description') - cls.service_data =\ - cls.service_client.create_service(s_name, s_type, - description=s_description) + cls.service_data = ( + cls.service_client.create_service(name=s_name, type=s_type, + description=s_description)) cls.service_data = cls.service_data['service'] cls.service_id = cls.service_data['id'] cls.service_ids.append(cls.service_id) @@ -112,9 +112,9 @@ class EndPointsTestJSON(base.BaseIdentityV3AdminTest): s_name = data_utils.rand_name('service') s_type = data_utils.rand_name('type') s_description = data_utils.rand_name('description') - service2 =\ - self.service_client.create_service(s_name, s_type, - description=s_description) + service2 = ( + self.service_client.create_service(name=s_name, type=s_type, + description=s_description)) service2 = service2['service'] self.service_ids.append(service2['id']) # Updating endpoint with new values diff --git a/tempest/api/identity/admin/v3/test_endpoints_negative.py b/tempest/api/identity/admin/v3/test_endpoints_negative.py index 5aa90a508a..8f9bf2a65f 100644 --- a/tempest/api/identity/admin/v3/test_endpoints_negative.py +++ b/tempest/api/identity/admin/v3/test_endpoints_negative.py @@ -37,7 +37,7 @@ class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest): s_type = data_utils.rand_name('type') s_description = data_utils.rand_name('description') cls.service_data = ( - cls.service_client.create_service(s_name, s_type, + cls.service_client.create_service(name=s_name, type=s_type, description=s_description) ['service']) cls.service_id = cls.service_data['id'] diff --git a/tempest/api/identity/admin/v3/test_services.py b/tempest/api/identity/admin/v3/test_services.py index dfb03df034..d1595dda6f 100644 --- a/tempest/api/identity/admin/v3/test_services.py +++ b/tempest/api/identity/admin/v3/test_services.py @@ -37,7 +37,7 @@ class ServicesTestJSON(base.BaseIdentityV3AdminTest): serv_type = data_utils.rand_name('type') desc = data_utils.rand_name('description') create_service = self.service_client.create_service( - serv_type, name=name, description=desc)['service'] + type=serv_type, name=name, description=desc)['service'] self.addCleanup(self._del_service, create_service['id']) self.assertIsNotNone(create_service['id']) @@ -68,7 +68,7 @@ class ServicesTestJSON(base.BaseIdentityV3AdminTest): name = data_utils.rand_name('service') serv_type = data_utils.rand_name('type') service = self.service_client.create_service( - serv_type, name=name)['service'] + type=serv_type, name=name)['service'] self.addCleanup(self.service_client.delete_service, service['id']) self.assertIn('id', service) expected_data = {'name': name, 'type': serv_type} @@ -82,7 +82,7 @@ class ServicesTestJSON(base.BaseIdentityV3AdminTest): name = data_utils.rand_name('service') serv_type = data_utils.rand_name('type') create_service = self.service_client.create_service( - serv_type, name=name)['service'] + type=serv_type, name=name)['service'] self.addCleanup(self.service_client.delete_service, create_service['id']) service_ids.append(create_service['id']) diff --git a/tempest/services/identity/v3/json/service_client.py b/tempest/services/identity/v3/json/service_client.py index 7af6209f7a..3dbfe5e846 100644 --- a/tempest/services/identity/v3/json/service_client.py +++ b/tempest/services/identity/v3/json/service_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#service-catalog-v3 +""" + from oslo_serialization import jsonutils as json from tempest.common import service_client @@ -22,17 +26,12 @@ class ServiceClient(service_client.ServiceClient): api_version = "v3" def update_service(self, service_id, **kwargs): - """Updates a service.""" - body = self.show_service(service_id)['service'] - name = kwargs.get('name', body['name']) - type = kwargs.get('type', body['type']) - desc = kwargs.get('description', body['description']) - patch_body = { - 'description': desc, - 'type': type, - 'name': name - } - patch_body = json.dumps({'service': patch_body}) + """Updates a service. + + Available params: see http://developer.openstack.org/ + api-ref-identity-v3.html#updateService + """ + patch_body = json.dumps({'service': kwargs}) resp, body = self.patch('services/%s' % service_id, patch_body) self.expected_success(200, resp.status) body = json.loads(body) @@ -46,15 +45,13 @@ class ServiceClient(service_client.ServiceClient): body = json.loads(body) return service_client.ResponseBody(resp, body) - def create_service(self, serv_type, name=None, description=None, - enabled=True): - body_dict = { - 'name': name, - 'type': serv_type, - 'enabled': enabled, - 'description': description, - } - body = json.dumps({'service': body_dict}) + def create_service(self, **kwargs): + """Creates a service. + + Available params: see http://developer.openstack.org/ + api-ref-identity-v3.html#createService + """ + body = json.dumps({'service': kwargs}) resp, body = self.post("services", body) self.expected_success(201, resp.status) body = json.loads(body)