Skip to content

Commit

Permalink
[api-ref]Fix response example file of update_type
Browse files Browse the repository at this point in the history
The response sample of "Update a volume type" interface refers to
that of "Show volume type detail", which is not the same.
So this is to add a functional test to generate the update volume
type response sample of "Update a volume type" own.

https://docs.openstack.org/api-ref/block-storage/v3/index.html#update-a-volume-type

Change-Id: I4e5bc87c6ab20ef6b85e0511d3965e7b1f4893ca
partially-implements: blueprint volume-response-schema-validation
  • Loading branch information
zhufl committed Aug 23, 2019
1 parent f0dddd6 commit 311b89c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"volume_type": {
"id": "6685584b-1eac-4da6-b5c3-555430cf68ff",
"name": "vol-type-001",
"description": "volume type 0001",
"is_public": true,
"extra_specs": {
"capabilities": "gpu"
}
}
}
2 changes: 1 addition & 1 deletion api-ref/source/v3/volumes-v3-types.inc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Response Parameters
Response Example
----------------

.. literalinclude:: ./samples/volume_type/volume-type-show-response.json
.. literalinclude:: ./samples/volume_type/volume-type-update-response.json
:language: javascript


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"volume_type": {
"name": "%(name)s",
"description": "%(description)s",
"is_public": "%(bool)s"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"volume_type": {
"id": "%(uuid)s",
"name": "vol-type-001",
"description": "volume type 0001",
"is_public": true,
"extra_specs": {
"capabilities": "gpu"
}
}
}
8 changes: 8 additions & 0 deletions cinder/tests/functional/api_sample_tests/test_volume_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ def test_volume_type_show(self):
self._verify_response('volume-type-show-response',
self.subs, response, 200)

def test_volume_type_update(self):
res = self._volume_type_create()
res = jsonutils.loads(res.content)['volume_type']
response = self._do_put(
'types/%s' % res['id'], 'volume-type-update-request', self.subs)
self._verify_response('volume-type-update-response',
self.subs, response, 200)

def test_volume_type_extra_spec_create_update(self):

res = self._volume_type_create()
Expand Down

0 comments on commit 311b89c

Please sign in to comment.