[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
This commit is contained in:
		| @@ -62,11 +62,13 @@ class TestQosAssociate(TestQos): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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( |         self.qos_mock.associate.assert_called_with( | ||||||
|             volume_fakes.qos_id, |             volume_fakes.qos_id, | ||||||
|             volume_fakes.type_id |             volume_fakes.type_id | ||||||
|         ) |         ) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestQosCreate(TestQos): | class TestQosCreate(TestQos): | ||||||
| @@ -204,11 +206,12 @@ class TestQosDelete(TestQos): | |||||||
|         verifylist = [ |         verifylist = [ | ||||||
|             ('qos_specs', [volume_fakes.qos_id]) |             ('qos_specs', [volume_fakes.qos_id]) | ||||||
|         ] |         ] | ||||||
|  |  | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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.qos_mock.delete.assert_called_with(volume_fakes.qos_id) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|     def test_qos_delete_with_name(self): |     def test_qos_delete_with_name(self): | ||||||
|         arglist = [ |         arglist = [ | ||||||
| @@ -217,11 +220,12 @@ class TestQosDelete(TestQos): | |||||||
|         verifylist = [ |         verifylist = [ | ||||||
|             ('qos_specs', [volume_fakes.qos_name]) |             ('qos_specs', [volume_fakes.qos_name]) | ||||||
|         ] |         ] | ||||||
|  |  | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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.qos_mock.delete.assert_called_with(volume_fakes.qos_id) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestQosDisassociate(TestQos): | class TestQosDisassociate(TestQos): | ||||||
| @@ -253,11 +257,13 @@ class TestQosDisassociate(TestQos): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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( |         self.qos_mock.disassociate.assert_called_with( | ||||||
|             volume_fakes.qos_id, |             volume_fakes.qos_id, | ||||||
|             volume_fakes.type_id |             volume_fakes.type_id | ||||||
|         ) |         ) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|     def test_qos_disassociate_with_all_volume_types(self): |     def test_qos_disassociate_with_all_volume_types(self): | ||||||
|         self.qos_mock.get.return_value = fakes.FakeResource( |         self.qos_mock.get.return_value = fakes.FakeResource( | ||||||
| @@ -275,8 +281,10 @@ class TestQosDisassociate(TestQos): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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.qos_mock.disassociate_all.assert_called_with(volume_fakes.qos_id) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestQosList(TestQos): | class TestQosList(TestQos): | ||||||
| @@ -351,11 +359,13 @@ class TestQosSet(TestQos): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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( |         self.qos_mock.set_keys.assert_called_with( | ||||||
|             volume_fakes.qos_id, |             volume_fakes.qos_id, | ||||||
|             volume_fakes.qos_specs |             volume_fakes.qos_specs | ||||||
|         ) |         ) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestQosShow(TestQos): | class TestQosShow(TestQos): | ||||||
| @@ -436,8 +446,10 @@ class TestQosUnset(TestQos): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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( |         self.qos_mock.unset_keys.assert_called_with( | ||||||
|             volume_fakes.qos_id, |             volume_fakes.qos_id, | ||||||
|             ['iops', 'foo'] |             ['iops', 'foo'] | ||||||
|         ) |         ) | ||||||
|  |         self.assertIsNone(result) | ||||||
|   | |||||||
| @@ -578,6 +578,7 @@ class TestVolumeSet(TestVolume): | |||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         parsed_args = self.check_parser(self.cmd, arglist, verifylist) | ||||||
|  |  | ||||||
|         result = self.cmd.run(parsed_args) |         result = self.cmd.run(parsed_args) | ||||||
|  |  | ||||||
|         self.assertEqual(0, result) |         self.assertEqual(0, result) | ||||||
|         self.assertEqual("No changes requested\n", |         self.assertEqual("No changes requested\n", | ||||||
|                          self.app.log.messages.get('error')) |                          self.app.log.messages.get('error')) | ||||||
| @@ -596,7 +597,7 @@ class TestVolumeSet(TestVolume): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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 |         # Set expected values | ||||||
|         kwargs = { |         kwargs = { | ||||||
| @@ -606,6 +607,7 @@ class TestVolumeSet(TestVolume): | |||||||
|             volume_fakes.volume_id, |             volume_fakes.volume_id, | ||||||
|             **kwargs |             **kwargs | ||||||
|         ) |         ) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|     def test_volume_set_description(self): |     def test_volume_set_description(self): | ||||||
|         arglist = [ |         arglist = [ | ||||||
| @@ -621,7 +623,7 @@ class TestVolumeSet(TestVolume): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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 |         # Set expected values | ||||||
|         kwargs = { |         kwargs = { | ||||||
| @@ -631,6 +633,7 @@ class TestVolumeSet(TestVolume): | |||||||
|             volume_fakes.volume_id, |             volume_fakes.volume_id, | ||||||
|             **kwargs |             **kwargs | ||||||
|         ) |         ) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|     def test_volume_set_size(self): |     def test_volume_set_size(self): | ||||||
|         arglist = [ |         arglist = [ | ||||||
| @@ -646,15 +649,15 @@ class TestVolumeSet(TestVolume): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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 |         # Set expected values | ||||||
|         size = 130 |         size = 130 | ||||||
|  |  | ||||||
|         self.volumes_mock.extend.assert_called_with( |         self.volumes_mock.extend.assert_called_with( | ||||||
|             volume_fakes.volume_id, |             volume_fakes.volume_id, | ||||||
|             size |             size | ||||||
|         ) |         ) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|     def test_volume_set_size_smaller(self): |     def test_volume_set_size_smaller(self): | ||||||
|         arglist = [ |         arglist = [ | ||||||
| @@ -671,6 +674,7 @@ class TestVolumeSet(TestVolume): | |||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         parsed_args = self.check_parser(self.cmd, arglist, verifylist) | ||||||
|  |  | ||||||
|         result = self.cmd.run(parsed_args) |         result = self.cmd.run(parsed_args) | ||||||
|  |  | ||||||
|         self.assertEqual(0, result) |         self.assertEqual(0, result) | ||||||
|         self.assertEqual("New size must be greater than %s GB" % |         self.assertEqual("New size must be greater than %s GB" % | ||||||
|                          volume_fakes.volume_size, |                          volume_fakes.volume_size, | ||||||
| @@ -692,6 +696,7 @@ class TestVolumeSet(TestVolume): | |||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         parsed_args = self.check_parser(self.cmd, arglist, verifylist) | ||||||
|  |  | ||||||
|         result = self.cmd.run(parsed_args) |         result = self.cmd.run(parsed_args) | ||||||
|  |  | ||||||
|         self.assertEqual(0, result) |         self.assertEqual(0, result) | ||||||
|         self.assertEqual("Volume is in %s state, it must be available before " |         self.assertEqual("Volume is in %s state, it must be available before " | ||||||
|                          "size can be extended" % 'error', |                          "size can be extended" % 'error', | ||||||
| @@ -711,7 +716,7 @@ class TestVolumeSet(TestVolume): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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 |         # Set expected values | ||||||
|         metadata = { |         metadata = { | ||||||
| @@ -721,3 +726,4 @@ class TestVolumeSet(TestVolume): | |||||||
|             volume_fakes.volume_id, |             volume_fakes.volume_id, | ||||||
|             metadata |             metadata | ||||||
|         ) |         ) | ||||||
|  |         self.assertIsNone(result) | ||||||
|   | |||||||
| @@ -99,11 +99,12 @@ class TestBackupDelete(TestBackup): | |||||||
|         verifylist = [ |         verifylist = [ | ||||||
|             ("backups", [volume_fakes.backup_id]) |             ("backups", [volume_fakes.backup_id]) | ||||||
|         ] |         ] | ||||||
|  |  | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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.backups_mock.delete.assert_called_with(volume_fakes.backup_id) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestBackupList(TestBackup): | class TestBackupList(TestBackup): | ||||||
| @@ -213,9 +214,10 @@ class TestBackupRestore(TestBackup): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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, |         self.restores_mock.restore.assert_called_with(volume_fakes.backup_id, | ||||||
|                                                       volume_fakes.volume_id) |                                                       volume_fakes.volume_id) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestBackupShow(TestBackup): | class TestBackupShow(TestBackup): | ||||||
|   | |||||||
| @@ -62,11 +62,13 @@ class TestQosAssociate(TestQos): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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( |         self.qos_mock.associate.assert_called_with( | ||||||
|             volume_fakes.qos_id, |             volume_fakes.qos_id, | ||||||
|             volume_fakes.type_id |             volume_fakes.type_id | ||||||
|         ) |         ) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestQosCreate(TestQos): | class TestQosCreate(TestQos): | ||||||
| @@ -205,11 +207,12 @@ class TestQosDelete(TestQos): | |||||||
|         verifylist = [ |         verifylist = [ | ||||||
|             ('qos_specs', [volume_fakes.qos_id]) |             ('qos_specs', [volume_fakes.qos_id]) | ||||||
|         ] |         ] | ||||||
|  |  | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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.qos_mock.delete.assert_called_with(volume_fakes.qos_id) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|     def test_qos_delete_with_name(self): |     def test_qos_delete_with_name(self): | ||||||
|         arglist = [ |         arglist = [ | ||||||
| @@ -218,11 +221,12 @@ class TestQosDelete(TestQos): | |||||||
|         verifylist = [ |         verifylist = [ | ||||||
|             ('qos_specs', [volume_fakes.qos_name]) |             ('qos_specs', [volume_fakes.qos_name]) | ||||||
|         ] |         ] | ||||||
|  |  | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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.qos_mock.delete.assert_called_with(volume_fakes.qos_id) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestQosDisassociate(TestQos): | class TestQosDisassociate(TestQos): | ||||||
| @@ -254,11 +258,13 @@ class TestQosDisassociate(TestQos): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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( |         self.qos_mock.disassociate.assert_called_with( | ||||||
|             volume_fakes.qos_id, |             volume_fakes.qos_id, | ||||||
|             volume_fakes.type_id |             volume_fakes.type_id | ||||||
|         ) |         ) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|     def test_qos_disassociate_with_all_volume_types(self): |     def test_qos_disassociate_with_all_volume_types(self): | ||||||
|         self.qos_mock.get.return_value = fakes.FakeResource( |         self.qos_mock.get.return_value = fakes.FakeResource( | ||||||
| @@ -276,8 +282,10 @@ class TestQosDisassociate(TestQos): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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.qos_mock.disassociate_all.assert_called_with(volume_fakes.qos_id) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestQosList(TestQos): | class TestQosList(TestQos): | ||||||
| @@ -352,11 +360,13 @@ class TestQosSet(TestQos): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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( |         self.qos_mock.set_keys.assert_called_with( | ||||||
|             volume_fakes.qos_id, |             volume_fakes.qos_id, | ||||||
|             volume_fakes.qos_specs |             volume_fakes.qos_specs | ||||||
|         ) |         ) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestQosShow(TestQos): | class TestQosShow(TestQos): | ||||||
| @@ -430,15 +440,16 @@ class TestQosUnset(TestQos): | |||||||
|             '--property', 'iops', |             '--property', 'iops', | ||||||
|             '--property', 'foo' |             '--property', 'foo' | ||||||
|         ] |         ] | ||||||
|  |  | ||||||
|         verifylist = [ |         verifylist = [ | ||||||
|             ('qos_spec', volume_fakes.qos_id), |             ('qos_spec', volume_fakes.qos_id), | ||||||
|             ('property', ['iops', 'foo']) |             ('property', ['iops', 'foo']) | ||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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( |         self.qos_mock.unset_keys.assert_called_with( | ||||||
|             volume_fakes.qos_id, |             volume_fakes.qos_id, | ||||||
|             ['iops', 'foo'] |             ['iops', 'foo'] | ||||||
|         ) |         ) | ||||||
|  |         self.assertIsNone(result) | ||||||
|   | |||||||
| @@ -97,11 +97,12 @@ class TestSnapshotDelete(TestSnapshot): | |||||||
|         verifylist = [ |         verifylist = [ | ||||||
|             ("snapshots", [volume_fakes.snapshot_id]) |             ("snapshots", [volume_fakes.snapshot_id]) | ||||||
|         ] |         ] | ||||||
|  |  | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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.snapshots_mock.delete.assert_called_with(volume_fakes.snapshot_id) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestSnapshotList(TestSnapshot): | class TestSnapshotList(TestSnapshot): | ||||||
| @@ -231,18 +232,19 @@ class TestSnapshotSet(TestSnapshot): | |||||||
|             ("name", "new_snapshot"), |             ("name", "new_snapshot"), | ||||||
|             ("property", new_property) |             ("property", new_property) | ||||||
|         ] |         ] | ||||||
|  |         parsed_args = self.check_parser(self.cmd, arglist, verifylist) | ||||||
|  |  | ||||||
|  |         result = self.cmd.take_action(parsed_args) | ||||||
|  |  | ||||||
|         kwargs = { |         kwargs = { | ||||||
|             "name": "new_snapshot", |             "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( |         self.snapshots_mock.update.assert_called_with( | ||||||
|             volume_fakes.snapshot_id, **kwargs) |             volume_fakes.snapshot_id, **kwargs) | ||||||
|         self.snapshots_mock.set_metadata.assert_called_with( |         self.snapshots_mock.set_metadata.assert_called_with( | ||||||
|             volume_fakes.snapshot_id, new_property |             volume_fakes.snapshot_id, new_property | ||||||
|         ) |         ) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestSnapshotShow(TestSnapshot): | class TestSnapshotShow(TestSnapshot): | ||||||
| @@ -296,10 +298,11 @@ class TestSnapshotUnset(TestSnapshot): | |||||||
|             ("snapshot", volume_fakes.snapshot_id), |             ("snapshot", volume_fakes.snapshot_id), | ||||||
|             ("property", ["foo"]) |             ("property", ["foo"]) | ||||||
|         ] |         ] | ||||||
|  |  | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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( |         self.snapshots_mock.delete_metadata.assert_called_with( | ||||||
|             volume_fakes.snapshot_id, ["foo"] |             volume_fakes.snapshot_id, ["foo"] | ||||||
|         ) |         ) | ||||||
|  |         self.assertIsNone(result) | ||||||
|   | |||||||
| @@ -137,11 +137,12 @@ class TestTypeDelete(TestType): | |||||||
|         verifylist = [ |         verifylist = [ | ||||||
|             ("volume_type", volume_fakes.type_id) |             ("volume_type", volume_fakes.type_id) | ||||||
|         ] |         ] | ||||||
|  |  | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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.types_mock.delete.assert_called_with(volume_fakes.type_id) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestTypeList(TestType): | class TestTypeList(TestType): | ||||||
| @@ -227,7 +228,7 @@ class TestTypeSet(TestType): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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 |         # Set expected values | ||||||
|         kwargs = { |         kwargs = { | ||||||
| @@ -237,6 +238,7 @@ class TestTypeSet(TestType): | |||||||
|             volume_fakes.type_id, |             volume_fakes.type_id, | ||||||
|             **kwargs |             **kwargs | ||||||
|         ) |         ) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|     def test_type_set_description(self): |     def test_type_set_description(self): | ||||||
|         new_desc = 'new_desc' |         new_desc = 'new_desc' | ||||||
| @@ -252,7 +254,7 @@ class TestTypeSet(TestType): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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 |         # Set expected values | ||||||
|         kwargs = { |         kwargs = { | ||||||
| @@ -262,6 +264,7 @@ class TestTypeSet(TestType): | |||||||
|             volume_fakes.type_id, |             volume_fakes.type_id, | ||||||
|             **kwargs |             **kwargs | ||||||
|         ) |         ) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|     def test_type_set_property(self): |     def test_type_set_property(self): | ||||||
|         arglist = [ |         arglist = [ | ||||||
| @@ -276,7 +279,8 @@ class TestTypeSet(TestType): | |||||||
|         ] |         ] | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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 |         result = self.types_mock.get.return_value._keys | ||||||
|         self.assertIn('myprop', result) |         self.assertIn('myprop', result) | ||||||
| @@ -338,8 +342,8 @@ class TestTypeUnset(TestType): | |||||||
|  |  | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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 |         result = self.types_mock.get.return_value._keys | ||||||
|  |  | ||||||
|         self.assertNotIn('property', result) |         self.assertNotIn('property', result) | ||||||
|   | |||||||
| @@ -396,11 +396,12 @@ class TestVolumeDelete(TestVolume): | |||||||
|         verifylist = [ |         verifylist = [ | ||||||
|             ("volumes", [volumes[0].id]) |             ("volumes", [volumes[0].id]) | ||||||
|         ] |         ] | ||||||
|  |  | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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.volumes_mock.delete.assert_called_with(volumes[0].id) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|     def test_volume_delete_multi_volumes(self): |     def test_volume_delete_multi_volumes(self): | ||||||
|         volumes = self.setup_volumes_mock(count=3) |         volumes = self.setup_volumes_mock(count=3) | ||||||
| @@ -409,14 +410,13 @@ class TestVolumeDelete(TestVolume): | |||||||
|         verifylist = [ |         verifylist = [ | ||||||
|             ('volumes', arglist), |             ('volumes', arglist), | ||||||
|         ] |         ] | ||||||
|  |  | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         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] |         calls = [call(v.id) for v in volumes] | ||||||
|  |  | ||||||
|         self.volumes_mock.delete.assert_has_calls(calls) |         self.volumes_mock.delete.assert_has_calls(calls) | ||||||
|  |         self.assertIsNone(result) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestVolumeList(TestVolume): | class TestVolumeList(TestVolume): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Tang Chen
					Tang Chen