summaryrefslogtreecommitdiff
path: root/cinderclient/tests
diff options
context:
space:
mode:
authorjeremy.zhang <zhangjun_inspur@163.com>2018-01-08 17:21:33 +0800
committerjeremy.zhang <zhangjun_inspur@163.com>2018-01-08 20:51:57 +0800
commit41d6ed0861d222858868375a7f0e3df86737a974 (patch)
tree2745bbe68537aada497d371afa30394a031d6abb /cinderclient/tests
parent36a2f4b4ebe8c46df2b7786ad9402ac7b12e700a (diff)
downloadpython-cinderclient-41d6ed0861d222858868375a7f0e3df86737a974.tar.gz
Fix v2 volume unit tests
This patch is mainly to fix the wrongly used fake client in v2 volume unit tests. Change-Id: If0d0aa7a95b7d58886cc77e8a377ac2f17985f18
Diffstat (limited to 'cinderclient/tests')
-rw-r--r--cinderclient/tests/unit/v2/test_volumes.py32
1 files changed, 15 insertions, 17 deletions
diff --git a/cinderclient/tests/unit/v2/test_volumes.py b/cinderclient/tests/unit/v2/test_volumes.py
index 60549ea..6e5fd2f 100644
--- a/cinderclient/tests/unit/v2/test_volumes.py
+++ b/cinderclient/tests/unit/v2/test_volumes.py
@@ -15,13 +15,11 @@
# License for the specific language governing permissions and limitations
# under the License.
-from cinderclient import api_versions
from cinderclient.tests.unit import utils
from cinderclient.tests.unit.v2 import fakes
from cinderclient.v2.volumes import Volume
cs = fakes.FakeClient()
-cs3 = fakes.FakeClient(api_versions.APIVersion('3.15'))
class VolumesTest(utils.TestCase):
@@ -213,23 +211,23 @@ class VolumesTest(utils.TestCase):
self._assert_request_id(vol)
def test_migrate(self):
- v = cs3.volumes.get('1234')
+ v = cs.volumes.get('1234')
self._assert_request_id(v)
- vol = cs3.volumes.migrate_volume(v, 'dest', False, False)
- cs3.assert_called('POST', '/volumes/1234/action',
- {'os-migrate_volume': {'host': 'dest',
- 'force_host_copy': False,
+ vol = cs.volumes.migrate_volume(v, 'dest', False, False)
+ cs.assert_called('POST', '/volumes/1234/action',
+ {'os-migrate_volume': {'host': 'dest',
+ 'force_host_copy': False,
'lock_volume': False}})
self._assert_request_id(vol)
def test_migrate_with_lock_volume(self):
- v = cs3.volumes.get('1234')
+ v = cs.volumes.get('1234')
self._assert_request_id(v)
- vol = cs3.volumes.migrate_volume(v, 'dest', False, True)
- cs3.assert_called('POST', '/volumes/1234/action',
- {'os-migrate_volume': {'host': 'dest',
- 'force_host_copy': False,
- 'lock_volume': True}})
+ vol = cs.volumes.migrate_volume(v, 'dest', False, True)
+ cs.assert_called('POST', '/volumes/1234/action',
+ {'os-migrate_volume': {'host': 'dest',
+ 'force_host_copy': False,
+ 'lock_volume': True}})
self._assert_request_id(vol)
def test_metadata_update_all(self):
@@ -262,19 +260,19 @@ class VolumesTest(utils.TestCase):
self._assert_request_id(vol)
def test_volume_manage(self):
- vol = cs3.volumes.manage('host1', {'k': 'v'})
+ vol = cs.volumes.manage('host1', {'k': 'v'})
expected = {'host': 'host1', 'name': None, 'availability_zone': None,
'description': None, 'metadata': None, 'ref': {'k': 'v'},
'volume_type': None, 'bootable': False}
- cs3.assert_called('POST', '/os-volume-manage', {'volume': expected})
+ cs.assert_called('POST', '/os-volume-manage', {'volume': expected})
self._assert_request_id(vol)
def test_volume_manage_bootable(self):
- vol = cs3.volumes.manage('host1', {'k': 'v'}, bootable=True)
+ vol = cs.volumes.manage('host1', {'k': 'v'}, bootable=True)
expected = {'host': 'host1', 'name': None, 'availability_zone': None,
'description': None, 'metadata': None, 'ref': {'k': 'v'},
'volume_type': None, 'bootable': True}
- cs3.assert_called('POST', '/os-volume-manage', {'volume': expected})
+ cs.assert_called('POST', '/os-volume-manage', {'volume': expected})
self._assert_request_id(vol)
def test_volume_list_manageable(self):