summaryrefslogtreecommitdiff
path: root/openstackclient/tests/volume/v1
diff options
context:
space:
mode:
authorTang Chen <chen.tang@easystack.cn>2016-02-29 16:50:54 +0800
committerTang Chen <chen.tang@easystack.cn>2016-03-03 21:07:08 +0800
commitb58dd4f17f60b3c6347683b619c093b8d1a40c0b (patch)
treeb4662ad2516501497ba8fc4a4174026f62d841b0 /openstackclient/tests/volume/v1
parent977eb4f1a659b7a3ea913eb6f145577975dfe36d (diff)
downloadpython-openstackclient-b58dd4f17f60b3c6347683b619c093b8d1a40c0b.tar.gz
[Volume] Check return value is None in volume unit tests
take_action() in commands inheriting from Command returns nothing. So we should assert the return is None in the unit tests of these commands. Change-Id: Idd961a5fa3db825353700837a559621d17f782c5 Partial-Bug: #1550636
Diffstat (limited to 'openstackclient/tests/volume/v1')
-rw-r--r--openstackclient/tests/volume/v1/test_qos_specs.py30
-rw-r--r--openstackclient/tests/volume/v1/test_volume.py16
2 files changed, 32 insertions, 14 deletions
diff --git a/openstackclient/tests/volume/v1/test_qos_specs.py b/openstackclient/tests/volume/v1/test_qos_specs.py
index 1a6c0fa4..4943f5df 100644
--- a/openstackclient/tests/volume/v1/test_qos_specs.py
+++ b/openstackclient/tests/volume/v1/test_qos_specs.py
@@ -62,11 +62,13 @@ class TestQosAssociate(TestQos):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
+
self.qos_mock.associate.assert_called_with(
volume_fakes.qos_id,
volume_fakes.type_id
)
+ self.assertIsNone(result)
class TestQosCreate(TestQos):
@@ -204,11 +206,12 @@ class TestQosDelete(TestQos):
verifylist = [
('qos_specs', [volume_fakes.qos_id])
]
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
+
self.qos_mock.delete.assert_called_with(volume_fakes.qos_id)
+ self.assertIsNone(result)
def test_qos_delete_with_name(self):
arglist = [
@@ -217,11 +220,12 @@ class TestQosDelete(TestQos):
verifylist = [
('qos_specs', [volume_fakes.qos_name])
]
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
+
self.qos_mock.delete.assert_called_with(volume_fakes.qos_id)
+ self.assertIsNone(result)
class TestQosDisassociate(TestQos):
@@ -253,11 +257,13 @@ class TestQosDisassociate(TestQos):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
+
self.qos_mock.disassociate.assert_called_with(
volume_fakes.qos_id,
volume_fakes.type_id
)
+ self.assertIsNone(result)
def test_qos_disassociate_with_all_volume_types(self):
self.qos_mock.get.return_value = fakes.FakeResource(
@@ -275,8 +281,10 @@ class TestQosDisassociate(TestQos):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
+
self.qos_mock.disassociate_all.assert_called_with(volume_fakes.qos_id)
+ self.assertIsNone(result)
class TestQosList(TestQos):
@@ -351,11 +359,13 @@ class TestQosSet(TestQos):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
+
self.qos_mock.set_keys.assert_called_with(
volume_fakes.qos_id,
volume_fakes.qos_specs
)
+ self.assertIsNone(result)
class TestQosShow(TestQos):
@@ -436,8 +446,10 @@ class TestQosUnset(TestQos):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
+
self.qos_mock.unset_keys.assert_called_with(
volume_fakes.qos_id,
['iops', 'foo']
)
+ self.assertIsNone(result)
diff --git a/openstackclient/tests/volume/v1/test_volume.py b/openstackclient/tests/volume/v1/test_volume.py
index 00c509b5..35fc917f 100644
--- a/openstackclient/tests/volume/v1/test_volume.py
+++ b/openstackclient/tests/volume/v1/test_volume.py
@@ -578,6 +578,7 @@ class TestVolumeSet(TestVolume):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args)
+
self.assertEqual(0, result)
self.assertEqual("No changes requested\n",
self.app.log.messages.get('error'))
@@ -596,7 +597,7 @@ class TestVolumeSet(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
# Set expected values
kwargs = {
@@ -606,6 +607,7 @@ class TestVolumeSet(TestVolume):
volume_fakes.volume_id,
**kwargs
)
+ self.assertIsNone(result)
def test_volume_set_description(self):
arglist = [
@@ -621,7 +623,7 @@ class TestVolumeSet(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
# Set expected values
kwargs = {
@@ -631,6 +633,7 @@ class TestVolumeSet(TestVolume):
volume_fakes.volume_id,
**kwargs
)
+ self.assertIsNone(result)
def test_volume_set_size(self):
arglist = [
@@ -646,15 +649,15 @@ class TestVolumeSet(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
# Set expected values
size = 130
-
self.volumes_mock.extend.assert_called_with(
volume_fakes.volume_id,
size
)
+ self.assertIsNone(result)
def test_volume_set_size_smaller(self):
arglist = [
@@ -671,6 +674,7 @@ class TestVolumeSet(TestVolume):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args)
+
self.assertEqual(0, result)
self.assertEqual("New size must be greater than %s GB" %
volume_fakes.volume_size,
@@ -692,6 +696,7 @@ class TestVolumeSet(TestVolume):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args)
+
self.assertEqual(0, result)
self.assertEqual("Volume is in %s state, it must be available before "
"size can be extended" % 'error',
@@ -711,7 +716,7 @@ class TestVolumeSet(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
# Set expected values
metadata = {
@@ -721,3 +726,4 @@ class TestVolumeSet(TestVolume):
volume_fakes.volume_id,
metadata
)
+ self.assertIsNone(result)