Merge "Separate resource_types_client from images_client"

This commit is contained in:
Jenkins
2016-06-09 02:04:31 +00:00
committed by Gerrit Code Review
5 changed files with 41 additions and 8 deletions
+1
View File
@@ -126,6 +126,7 @@ class BaseV2ImageTest(BaseImageTest):
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
@@ -26,7 +26,7 @@ class MetadataNamespacesTest(base.BaseV2ImageTest):
@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')
+10
View File
@@ -138,6 +138,8 @@ from tempest.services.image.v2.json.images_client import \
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 @@ class Manager(manager.Manager):
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,
@@ -131,10 +131,3 @@ class ImagesClient(rest_client.RestClient):
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)
@@ -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)