add show detail for volume Api V3
add show details for volume api v3 and add unit test Change-Id: I029aa08cb7286e1b4cd995642928d667b87afb44
This commit is contained in:
parent
d605315e7f
commit
db10fb0703
@ -0,0 +1,7 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Add show api version details function to v3
|
||||
versions_client library for cinder.
|
||||
|
||||
* show_version
|
@ -58,3 +58,49 @@ list_versions = {
|
||||
'required': ['versions'],
|
||||
}
|
||||
}
|
||||
|
||||
volume_api_version_details = {
|
||||
'status_code': [200],
|
||||
'response_body': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'versions': {
|
||||
'type': 'array',
|
||||
'items': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'status': {'type': 'string'},
|
||||
'updated': {'type': 'string'},
|
||||
'id': {'type': 'string'},
|
||||
'links': {
|
||||
'type': 'array',
|
||||
'items': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'href': {'type': 'string',
|
||||
'format': 'uri'},
|
||||
'rel': {'type': 'string'},
|
||||
'type': {'type': 'string'},
|
||||
},
|
||||
'required': ['href', 'rel']
|
||||
}
|
||||
},
|
||||
'min_version': {'type': 'string'},
|
||||
'version': {'type': 'string'},
|
||||
'media-types': {
|
||||
'type': 'array',
|
||||
'properties': {
|
||||
'base': {'type': 'string'},
|
||||
'type': {'type': 'string'}
|
||||
},
|
||||
'required': ['base', 'type']
|
||||
}
|
||||
},
|
||||
'required': ['status', 'updated', 'id', 'links',
|
||||
'min_version', 'version', 'media-types']
|
||||
}
|
||||
}
|
||||
},
|
||||
'required': ['versions'],
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
import time
|
||||
|
||||
from oslo_serialization import jsonutils as json
|
||||
@ -45,3 +46,17 @@ class VersionsClient(base_client.BaseClient):
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.list_versions, resp, body)
|
||||
return rest_client.ResponseBody(resp, body)
|
||||
|
||||
def show_version(self, version):
|
||||
"""Show API version details
|
||||
|
||||
For a full list of available parameters, please refer to the official
|
||||
API reference:
|
||||
https://docs.openstack.org/api-ref/block-storage/v3/#show-api-v3-details
|
||||
"""
|
||||
|
||||
version_url = os.path.join(self._get_base_version_url(), version)
|
||||
resp, body = self.get(version_url)
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.volume_api_version_details, resp, body)
|
||||
return rest_client.ResponseBody(resp, body)
|
||||
|
@ -69,6 +69,27 @@ class TestVersionsClient(base.BaseServiceTest):
|
||||
]
|
||||
}
|
||||
|
||||
FAKE_VERSION_DETAILS = {
|
||||
"versions": [
|
||||
{
|
||||
"id": "v3.0",
|
||||
"links": [
|
||||
{"href": "https://docs.openstack.org/",
|
||||
"type": "text/html", "rel": "describedby"},
|
||||
{"href": "http://127.0.0.1:44895/v3/", "rel": "self"}
|
||||
],
|
||||
"media-types": [
|
||||
{"base": "application/json",
|
||||
"type": "application/vnd.openstack.volume+json;version=3"}
|
||||
],
|
||||
"min_version": "3.0",
|
||||
"status": "CURRENT",
|
||||
"updated": "2018-07-17T00:00:00Z",
|
||||
"version": "3.59"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
def setUp(self):
|
||||
super(TestVersionsClient, self).setUp()
|
||||
fake_auth = fake_auth_provider.FakeAuthProvider()
|
||||
@ -89,3 +110,17 @@ class TestVersionsClient(base.BaseServiceTest):
|
||||
|
||||
def test_list_versions_with_bytes_body(self):
|
||||
self._test_list_versions(bytes_body=True)
|
||||
|
||||
def _test_show_version(self, bytes_body=False):
|
||||
self.check_service_client_function(
|
||||
self.client.show_version,
|
||||
'tempest.lib.common.rest_client.RestClient.get',
|
||||
self.FAKE_VERSION_DETAILS,
|
||||
bytes_body,
|
||||
200, version='v3')
|
||||
|
||||
def test_show_version_details_with_str_body(self):
|
||||
self._test_show_version()
|
||||
|
||||
def test_show_version_details_with_bytes_body(self):
|
||||
self._test_show_version(bytes_body=True)
|
||||
|
Loading…
Reference in New Issue
Block a user