Added return statement to retype_volume in v2 volumes_client

This commit adds a missing return statement to the retype_volume API
endpoint in the v2 volumes_client. Otherwise, None, instead of an
empty dict, is returned for the response body.

Closes-Bug: #1703997
Partially Implements: blueprint tempest-lib-missing-test-coverage
Change-Id: I1a308f486fd7b14a9111a3433284e3c4abf65bd3
This commit is contained in:
raigax9 2017-07-12 18:31:39 -04:00 committed by Felipe Monteiro
parent d3fa46495a
commit d850882db2
3 changed files with 28 additions and 0 deletions

View File

@ -318,6 +318,7 @@ class VolumesClient(base_client.BaseClient):
post_body = json.dumps({'os-retype': kwargs})
resp, body = self.post('volumes/%s/action' % volume_id, post_body)
self.expected_success(202, resp.status)
return rest_client.ResponseBody(resp, body)
def force_detach_volume(self, volume_id, **kwargs):
"""Force detach a volume.

View File

@ -0,0 +1,5 @@
---
fixes:
Add a missing return statement to the retype_volume API in the v2 volumes_client library.
This changes the response body from None to an empty dictionary.

View File

@ -33,6 +33,22 @@ class TestVolumesClient(base.BaseServiceTest):
'volume',
'regionOne')
def _test_retype_volume(self, bytes_body=False):
kwargs = {
"new_type": "dedup-tier-replication",
"migration_policy": "never"
}
self.check_service_client_function(
self.client.retype_volume,
'tempest.lib.common.rest_client.RestClient.post',
{},
to_utf=bytes_body,
status=202,
volume_id="a3be971b-8de5-4bdf-bdb8-3d8eb0fb69f8",
**kwargs
)
def _test_force_detach_volume(self, bytes_body=False):
kwargs = {
'attachment_id': '6980e295-920f-412e-b189-05c50d605acd',
@ -71,3 +87,9 @@ class TestVolumesClient(base.BaseServiceTest):
def test_show_volume_metadata_item_with_bytes_body(self):
self._test_show_volume_metadata_item(bytes_body=True)
def test_retype_volume_with_str_body(self):
self._test_retype_volume()
def test_retype_volume_with_bytes_body(self):
self._test_retype_volume(bytes_body=True)