summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-03-04 17:55:25 +0000
committerGerrit Code Review <review@openstack.org>2016-03-04 17:55:26 +0000
commit0bf65361f5745defe8857ae2460761f150dc9a3a (patch)
tree87b50c987c3b5ec17ffdcfd2861bc4c150e32936 /openstackclient
parent6a96ffc22130f2a852f3371df9aa1e0eb5de9934 (diff)
parentb58dd4f17f60b3c6347683b619c093b8d1a40c0b (diff)
downloadpython-openstackclient-0bf65361f5745defe8857ae2460761f150dc9a3a.tar.gz
Merge "[Volume] Check return value is None in volume unit tests"
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/tests/volume/v1/test_qos_specs.py30
-rw-r--r--openstackclient/tests/volume/v1/test_volume.py16
-rw-r--r--openstackclient/tests/volume/v2/test_backup.py8
-rw-r--r--openstackclient/tests/volume/v2/test_qos_specs.py31
-rw-r--r--openstackclient/tests/volume/v2/test_snapshot.py17
-rw-r--r--openstackclient/tests/volume/v2/test_type.py18
-rw-r--r--openstackclient/tests/volume/v2/test_volume.py10
7 files changed, 84 insertions, 46 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)
diff --git a/openstackclient/tests/volume/v2/test_backup.py b/openstackclient/tests/volume/v2/test_backup.py
index 6fe3f666..cc8dff5a 100644
--- a/openstackclient/tests/volume/v2/test_backup.py
+++ b/openstackclient/tests/volume/v2/test_backup.py
@@ -99,11 +99,12 @@ class TestBackupDelete(TestBackup):
verifylist = [
("backups", [volume_fakes.backup_id])
]
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
+
self.backups_mock.delete.assert_called_with(volume_fakes.backup_id)
+ self.assertIsNone(result)
class TestBackupList(TestBackup):
@@ -213,9 +214,10 @@ class TestBackupRestore(TestBackup):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
self.restores_mock.restore.assert_called_with(volume_fakes.backup_id,
volume_fakes.volume_id)
+ self.assertIsNone(result)
class TestBackupShow(TestBackup):
diff --git a/openstackclient/tests/volume/v2/test_qos_specs.py b/openstackclient/tests/volume/v2/test_qos_specs.py
index c826925f..5232285c 100644
--- a/openstackclient/tests/volume/v2/test_qos_specs.py
+++ b/openstackclient/tests/volume/v2/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):
@@ -205,11 +207,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 = [
@@ -218,11 +221,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):
@@ -254,11 +258,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(
@@ -276,8 +282,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):
@@ -352,11 +360,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):
@@ -430,15 +440,16 @@ class TestQosUnset(TestQos):
'--property', 'iops',
'--property', 'foo'
]
-
verifylist = [
('qos_spec', volume_fakes.qos_id),
('property', ['iops', 'foo'])
]
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/v2/test_snapshot.py b/openstackclient/tests/volume/v2/test_snapshot.py
index 349e8dac..87e2fccf 100644
--- a/openstackclient/tests/volume/v2/test_snapshot.py
+++ b/openstackclient/tests/volume/v2/test_snapshot.py
@@ -97,11 +97,12 @@ class TestSnapshotDelete(TestSnapshot):
verifylist = [
("snapshots", [volume_fakes.snapshot_id])
]
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
+
self.snapshots_mock.delete.assert_called_with(volume_fakes.snapshot_id)
+ self.assertIsNone(result)
class TestSnapshotList(TestSnapshot):
@@ -231,18 +232,19 @@ class TestSnapshotSet(TestSnapshot):
("name", "new_snapshot"),
("property", new_property)
]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ result = self.cmd.take_action(parsed_args)
kwargs = {
"name": "new_snapshot",
}
- parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
-
self.snapshots_mock.update.assert_called_with(
volume_fakes.snapshot_id, **kwargs)
self.snapshots_mock.set_metadata.assert_called_with(
volume_fakes.snapshot_id, new_property
)
+ self.assertIsNone(result)
class TestSnapshotShow(TestSnapshot):
@@ -296,10 +298,11 @@ class TestSnapshotUnset(TestSnapshot):
("snapshot", volume_fakes.snapshot_id),
("property", ["foo"])
]
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+
+ result = self.cmd.take_action(parsed_args)
self.snapshots_mock.delete_metadata.assert_called_with(
volume_fakes.snapshot_id, ["foo"]
)
+ self.assertIsNone(result)
diff --git a/openstackclient/tests/volume/v2/test_type.py b/openstackclient/tests/volume/v2/test_type.py
index 1408b9d9..b014706b 100644
--- a/openstackclient/tests/volume/v2/test_type.py
+++ b/openstackclient/tests/volume/v2/test_type.py
@@ -137,11 +137,12 @@ class TestTypeDelete(TestType):
verifylist = [
("volume_type", volume_fakes.type_id)
]
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
+
self.types_mock.delete.assert_called_with(volume_fakes.type_id)
+ self.assertIsNone(result)
class TestTypeList(TestType):
@@ -227,7 +228,7 @@ class TestTypeSet(TestType):
]
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 = {
@@ -237,6 +238,7 @@ class TestTypeSet(TestType):
volume_fakes.type_id,
**kwargs
)
+ self.assertIsNone(result)
def test_type_set_description(self):
new_desc = 'new_desc'
@@ -252,7 +254,7 @@ class TestTypeSet(TestType):
]
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 = {
@@ -262,6 +264,7 @@ class TestTypeSet(TestType):
volume_fakes.type_id,
**kwargs
)
+ self.assertIsNone(result)
def test_type_set_property(self):
arglist = [
@@ -276,7 +279,8 @@ class TestTypeSet(TestType):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
+ self.assertIsNone(result)
result = self.types_mock.get.return_value._keys
self.assertIn('myprop', result)
@@ -338,8 +342,8 @@ class TestTypeUnset(TestType):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
+ self.assertIsNone(result)
result = self.types_mock.get.return_value._keys
-
self.assertNotIn('property', result)
diff --git a/openstackclient/tests/volume/v2/test_volume.py b/openstackclient/tests/volume/v2/test_volume.py
index cbca09b2..a836f79e 100644
--- a/openstackclient/tests/volume/v2/test_volume.py
+++ b/openstackclient/tests/volume/v2/test_volume.py
@@ -396,11 +396,12 @@ class TestVolumeDelete(TestVolume):
verifylist = [
("volumes", [volumes[0].id])
]
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
+
self.volumes_mock.delete.assert_called_with(volumes[0].id)
+ self.assertIsNone(result)
def test_volume_delete_multi_volumes(self):
volumes = self.setup_volumes_mock(count=3)
@@ -409,14 +410,13 @@ class TestVolumeDelete(TestVolume):
verifylist = [
('volumes', arglist),
]
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
calls = [call(v.id) for v in volumes]
-
self.volumes_mock.delete.assert_has_calls(calls)
+ self.assertIsNone(result)
class TestVolumeList(TestVolume):