Separate resource_types_client from images_client
Each resource should be separeted into specific service client.
So this patch separates resource_types_client from images_client.
Partially implements blueprint consistent-service-method-names
Change-Id: I8518b7940c965af0037a7323ab6dd53f8f180b6d
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index 6d0fa8e..307d6d6 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -126,6 +126,7 @@
super(BaseV2ImageTest, cls).setup_clients()
cls.client = cls.os.image_client_v2
cls.namespaces_client = cls.os.namespaces_client
+ cls.resource_types_client = cls.os.resource_types_client
cls.schemas_client = cls.os.schemas_client
diff --git a/tempest/api/image/v2/test_images_metadefs_namespaces.py b/tempest/api/image/v2/test_images_metadefs_namespaces.py
index f6d1bdc..6fced00 100644
--- a/tempest/api/image/v2/test_images_metadefs_namespaces.py
+++ b/tempest/api/image/v2/test_images_metadefs_namespaces.py
@@ -26,7 +26,7 @@
@test.idempotent_id('319b765e-7f3d-4b3d-8b37-3ca3876ee768')
def test_basic_metadata_definition_namespaces(self):
# get the available resource types and use one resource_type
- body = self.client.list_resource_types()
+ body = self.resource_types_client.list_resource_types()
resource_name = body['resource_types'][0]['name']
name = [{'name': resource_name}]
namespace_name = data_utils.rand_name('namespace')
diff --git a/tempest/clients.py b/tempest/clients.py
index de9b88a..f71d3ce 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -138,6 +138,8 @@
from tempest.services.image.v2.json.members_client import MembersClient \
as MembersClientV2
from tempest.services.image.v2.json.namespaces_client import NamespacesClient
+from tempest.services.image.v2.json.resource_types_client import \
+ ResourceTypesClient
from tempest.services.image.v2.json.schemas_client import SchemasClient
from tempest.services.object_storage.account_client import AccountClient
from tempest.services.object_storage.container_client import ContainerClient
@@ -369,6 +371,14 @@
build_interval=CONF.image.build_interval,
build_timeout=CONF.image.build_timeout,
**self.default_params)
+ self.resource_types_client = ResourceTypesClient(
+ self.auth_provider,
+ CONF.image.catalog_type,
+ CONF.image.region or CONF.identity.region,
+ endpoint_type=CONF.image.endpoint_type,
+ build_interval=CONF.image.build_interval,
+ build_timeout=CONF.image.build_timeout,
+ **self.default_params)
self.schemas_client = SchemasClient(
self.auth_provider,
CONF.image.catalog_type,
diff --git a/tempest/services/image/v2/json/images_client.py b/tempest/services/image/v2/json/images_client.py
index aae1cd0..71e7c6b 100644
--- a/tempest/services/image/v2/json/images_client.py
+++ b/tempest/services/image/v2/json/images_client.py
@@ -131,10 +131,3 @@
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
return rest_client.ResponseBody(resp)
-
- def list_resource_types(self):
- url = 'metadefs/resource_types'
- resp, body = self.get(url)
- self.expected_success(200, resp.status)
- body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
diff --git a/tempest/services/image/v2/json/resource_types_client.py b/tempest/services/image/v2/json/resource_types_client.py
new file mode 100644
index 0000000..1349c63
--- /dev/null
+++ b/tempest/services/image/v2/json/resource_types_client.py
@@ -0,0 +1,29 @@
+# Copyright 2013 IBM Corp.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from oslo_serialization import jsonutils as json
+
+from tempest.lib.common import rest_client
+
+
+class ResourceTypesClient(rest_client.RestClient):
+ api_version = "v2"
+
+ def list_resource_types(self):
+ url = 'metadefs/resource_types'
+ resp, body = self.get(url)
+ self.expected_success(200, resp.status)
+ body = json.loads(body)
+ return rest_client.ResponseBody(resp, body)