From e776a4f0260af1d2ae66439e647794395d470578 Mon Sep 17 00:00:00 2001 From: David Rabel Date: Fri, 22 Feb 2019 15:21:17 +0100 Subject: Add --attached / --detached parameter to volume set As to reflect cinder reset-state --attach-status functionality, this patch adds --attached / --detached parameter to OSC's volume set command. Change-Id: Ic8ee928c9ab0e579512cfb7608f63bfcc2993c7b Closes-Bug: #1745699 --- .../tests/unit/volume/v2/test_volume.py | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'openstackclient/tests') diff --git a/openstackclient/tests/unit/volume/v2/test_volume.py b/openstackclient/tests/unit/volume/v2/test_volume.py index 1f53ce94..dbe69ea0 100644 --- a/openstackclient/tests/unit/volume/v2/test_volume.py +++ b/openstackclient/tests/unit/volume/v2/test_volume.py @@ -1327,6 +1327,42 @@ class TestVolumeSet(TestVolume): self.volumes_mock.reset_state.assert_called_with( self.new_volume.id, 'error') + def test_volume_set_attached(self): + arglist = [ + '--attached', + self.new_volume.id + ] + verifylist = [ + ('attached', True), + ('detached', False), + ('volume', self.new_volume.id) + ] + + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + result = self.cmd.take_action(parsed_args) + self.volumes_mock.reset_state.assert_called_with( + self.new_volume.id, attach_status='attached', state=None) + self.assertIsNone(result) + + def test_volume_set_detached(self): + arglist = [ + '--detached', + self.new_volume.id + ] + verifylist = [ + ('attached', False), + ('detached', True), + ('volume', self.new_volume.id) + ] + + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + result = self.cmd.take_action(parsed_args) + self.volumes_mock.reset_state.assert_called_with( + self.new_volume.id, attach_status='detached', state=None) + self.assertIsNone(result) + def test_volume_set_bootable(self): arglist = [ ['--bootable', self.new_volume.id], -- cgit v1.2.1