Commit 4a17d307 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Expose image-unregister to cli and unittest it

parent fd6608bd
......@@ -247,6 +247,21 @@ class image_register(_init_image):
self._run(name, location)
@command(image_cmds)
class image_unregister(_init_image):
"""Unregister an image (does not delete the image file)"""
@errors.generic.all
@errors.plankton.connection
@errors.plankton.id
def _run(self, image_id):
self.client.unregister(image_id)
def main(self, image_id):
super(self.__class__, self)._run()
self._run(image_id=image_id)
@command(image_cmds)
class image_members(_init_image):
"""Get image members"""
......
......@@ -236,6 +236,12 @@ class ImageClient(TestCase):
call('X-Image-Meta-Name', img0_name),
call('X-Image-Meta-Location', img0_location)])
@patch('%s.delete' % image_pkg)
def test_unregister(self, delete):
img_id = 'an1m4g3'
self.client.unregister(img_id)
delete.assert_called_once_with('/images/%s' % img_id, success=204)
@patch('%s.put' % image_pkg, return_value=FR())
def test_set_members(self, put):
members = ['use3r-1d-0', 'us2r-1d-1', 'us3r-1d-2']
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment