Merge "Fix object storage capabilities client return value"

This commit is contained in:
Jenkins 2017-07-24 19:53:04 +00:00 committed by Gerrit Code Review
commit afc9f2d0bd
7 changed files with 67 additions and 13 deletions

View File

@ -98,7 +98,7 @@ class BaseObjectTest(tempest.test.BaseTestCase):
cls.policies = None
if CONF.object_storage_feature_enabled.discoverability:
_, body = cls.capabilities_client.list_capabilities()
body = cls.capabilities_client.list_capabilities()
if 'swift' in body and 'policies' in body['swift']:
cls.policies = body['swift']['policies']

View File

@ -135,7 +135,7 @@ class AccountTest(base.BaseObjectTest):
not CONF.object_storage_feature_enabled.discoverability,
'Discoverability function is disabled')
def test_list_extensions(self):
resp, _ = self.capabilities_client.list_capabilities()
resp = self.capabilities_client.list_capabilities()
self.assertThat(resp, custom_matchers.AreAllWellFormatted())

View File

@ -32,7 +32,7 @@ class ContainerNegativeTest(base.BaseObjectTest):
if CONF.object_storage_feature_enabled.discoverability:
# use /info to get default constraints
_, body = cls.capabilities_client.list_capabilities()
body = cls.capabilities_client.list_capabilities()
cls.constraints = body['swift']
@decorators.attr(type=["negative"])

View File

@ -200,7 +200,7 @@ def verify_extensions(os, service, results):
if service != 'swift':
resp = extensions_client.list_extensions()
else:
__, resp = extensions_client.list_capabilities()
resp = extensions_client.list_capabilities()
# For Nova, Cinder and Neutron we use the alias name rather than the
# 'name' field because the alias is considered to be the canonical
# name.

View File

@ -28,4 +28,4 @@ class CapabilitiesClient(rest_client.RestClient):
self.reset_path()
body = json.loads(body)
self.expected_success(200, resp.status)
return resp, body
return rest_client.ResponseBody(resp, body)

View File

@ -392,10 +392,10 @@ class TestDiscovery(base.TestCase):
def test_verify_extensions_swift(self):
def fake_list_extensions():
return (None, {'fake1': 'metadata',
'fake2': 'metadata',
'not_fake': 'metadata',
'swift': 'metadata'})
return {'fake1': 'metadata',
'fake2': 'metadata',
'not_fake': 'metadata',
'swift': 'metadata'}
fake_os = mock.MagicMock()
fake_os.capabilities_client.list_capabilities = fake_list_extensions
self.useFixture(fixtures.MockPatchObject(
@ -414,10 +414,10 @@ class TestDiscovery(base.TestCase):
def test_verify_extensions_swift_all(self):
def fake_list_extensions():
return (None, {'fake1': 'metadata',
'fake2': 'metadata',
'not_fake': 'metadata',
'swift': 'metadata'})
return {'fake1': 'metadata',
'fake2': 'metadata',
'not_fake': 'metadata',
'swift': 'metadata'}
fake_os = mock.MagicMock()
fake_os.capabilities_client.list_capabilities = fake_list_extensions
self.useFixture(fixtures.MockPatchObject(

View File

@ -0,0 +1,54 @@
# Copyright 2016 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 tempest.services.object_storage import capabilities_client
from tempest.tests.lib import fake_auth_provider
from tempest.tests.lib.services import base
class TestCapabilitiesClient(base.BaseServiceTest):
def setUp(self):
super(TestCapabilitiesClient, self).setUp()
self.fake_auth = fake_auth_provider.FakeAuthProvider()
self.url = self.fake_auth.base_url(None)
self.client = capabilities_client.CapabilitiesClient(
self.fake_auth, 'swift', 'region1')
def _test_list_capabilities(self, bytes_body=False):
resp = {
"swift": {
"version": "1.11.0"
},
"slo": {
"max_manifest_segments": 1000,
"max_manifest_size": 2097152,
"min_segment_size": 1
},
"staticweb": {},
"tempurl": {}
}
self.check_service_client_function(
self.client.list_capabilities,
'tempest.lib.common.rest_client.RestClient.get',
resp,
bytes_body)
def test_list_capabilities_with_str_body(self):
self._test_list_capabilities()
def test_list_capabilities_with_bytes_body(self):
self._test_list_capabilities(True)