Added reactivate/deactivate image using CLI

Added commands 'glance image-reactivate image_id'
and 'glance image-deactivate image_id' for
reactivate/deactivate image using CLI

DocImpact

Change-Id: I2c370c6bf6ff664d94d756cc76aaa983fbdb8869
Closes-bug: #1508356
This commit is contained in:
Darja Shakhray
2015-10-23 18:25:25 +03:00
committed by Mike Fedosin
parent c0975934c0
commit bff356ed73
4 changed files with 66 additions and 0 deletions
@@ -601,6 +601,24 @@ class ShellV2Test(testtools.TestCase):
test_shell.do_image_delete(self.gc, args)
self.assertEqual(2, mocked_delete.call_count)
def test_do_image_deactivate(self):
args = argparse.Namespace(id='image1')
with mock.patch.object(self.gc.images,
'deactivate') as mocked_deactivate:
mocked_deactivate.return_value = 0
test_shell.do_image_deactivate(self.gc, args)
self.assertEqual(1, mocked_deactivate.call_count)
def test_do_image_reactivate(self):
args = argparse.Namespace(id='image1')
with mock.patch.object(self.gc.images,
'reactivate') as mocked_reactivate:
mocked_reactivate.return_value = 0
test_shell.do_image_reactivate(self.gc, args)
self.assertEqual(1, mocked_reactivate.call_count)
@mock.patch.object(utils, 'exit')
@mock.patch.object(utils, 'print_err')
def test_do_image_delete_with_invalid_ids(self, mocked_print_err,