openstackclient.tests.image.v2 package

Submodules

openstackclient.tests.image.v2.fakes module

class openstackclient.tests.image.v2.fakes.FakeImage

Bases: object

Fake one or more images.

TODO(xiexs): Currently, only image API v2 is supported by this class.

static create_images(attrs={}, count=2)

Create multiple fake images.

Parameters:
  • attrs (Dictionary) – A dictionary with all attributes of image
  • count (Integer) – The number of images to be faked
Returns:

A list of FakeResource objects

static create_one_image(attrs={})

Create a fake image.

Parameters:attrs (Dictionary) – A dictionary with all attrbutes of image
Retrun:A FakeResource object with id, name, owner, protected, visibility and tags attrs
static get_image_columns(image=None)

Get the image columns from a faked image object.

Parameters:image – A FakeResource objects faking image
:return
A tuple which may include the following keys: (‘id’, ‘name’, ‘owner’, ‘protected’, ‘visibility’, ‘tags’)
static get_image_data(image=None)

Get the image data from a faked image object.

Parameters:image – A FakeResource objects faking image
:return
A tuple which may include the following values: (‘image-123’, ‘image-foo’, ‘admin’, False, ‘public’, ‘bar, baz’)
static get_image_info(image=None)

Get the image info from a faked image object.

Parameters:image – A FakeResource objects faking image
:return

A dictionary which includes the faked image info as follows: {

‘id’: image_id, ‘name’: image_name, ‘owner’: image_owner, ‘protected’: image_protected, ‘visibility’: image_visibility, ‘tags’: image_tags

}

static get_images(images=None, count=2)

Get an iterable MagicMock object with a list of faked images.

If images list is provided, then initialize the Mock object with the list. Otherwise create one.

Parameters:
  • images (List) – A list of FakeResource objects faking images
  • count (Integer) – The number of images to be faked
:return
An iterable Mock object with side_effect set to a list of faked images
class openstackclient.tests.image.v2.fakes.FakeImagev2Client(**kwargs)

Bases: object

class openstackclient.tests.image.v2.fakes.TestImagev2(*args, **kwargs)

Bases: openstackclient.tests.utils.TestCommand

setUp()

openstackclient.tests.image.v2.test_image module

class openstackclient.tests.image.v2.test_image.TestAddProjectToImage(*args, **kwargs)

Bases: openstackclient.tests.image.v2.test_image.TestImage

columns = ('image_id', 'member_id', 'status')
datalist = ('0f41529e-7c12-4de8-be2d-181abb825b3c', '8-9-64', 'pending')
setUp()
test_add_project_to_image_no_option()
test_add_project_to_image_with_option()
class openstackclient.tests.image.v2.test_image.TestImage(*args, **kwargs)

Bases: openstackclient.tests.image.v2.fakes.TestImagev2

setUp()
setup_images_mock(count)
class openstackclient.tests.image.v2.test_image.TestImageCreate(*args, **kwargs)

Bases: openstackclient.tests.image.v2.test_image.TestImage

setUp()
test_image_create_dead_options()
test_image_create_file(*args, **keywargs)
test_image_create_with_unexist_owner()
test_image_create_with_unexist_project()
test_image_reserve_no_options()
test_image_reserve_options(*args, **keywargs)
class openstackclient.tests.image.v2.test_image.TestImageDelete(*args, **kwargs)

Bases: openstackclient.tests.image.v2.test_image.TestImage

setUp()
test_image_delete_multi_images()
test_image_delete_no_options()
class openstackclient.tests.image.v2.test_image.TestImageList(*args, **kwargs)

Bases: openstackclient.tests.image.v2.test_image.TestImage

columns = ('ID', 'Name', 'Status')
datalist = (('0f41529e-7c12-4de8-be2d-181abb825b3c', 'graven', ''),)
setUp()
test_image_list_limit_option()
test_image_list_long_option()
test_image_list_marker_option(*args, **keywargs)
test_image_list_no_options()
test_image_list_private_option()
test_image_list_property_option(*args, **keywargs)
test_image_list_public_option()
test_image_list_shared_option()
test_image_list_sort_option(*args, **keywargs)
class openstackclient.tests.image.v2.test_image.TestImageSet(*args, **kwargs)

Bases: openstackclient.tests.image.v2.test_image.TestImage

setUp()
test_image_set_activate()
test_image_set_bools1()
test_image_set_bools2()
test_image_set_deactivate()
test_image_set_dead_options()
test_image_set_fake_properties()
test_image_set_options()
test_image_set_properties()
test_image_set_tag()
test_image_set_tag_merge()
test_image_set_tag_merge_dupe()
test_image_set_with_unexist_owner()
test_image_set_with_unexist_project()
class openstackclient.tests.image.v2.test_image.TestImageShow(*args, **kwargs)

Bases: openstackclient.tests.image.v2.test_image.TestImage

setUp()
test_image_show()
class openstackclient.tests.image.v2.test_image.TestRemoveProjectImage(*args, **kwargs)

Bases: openstackclient.tests.image.v2.test_image.TestImage

setUp()
test_remove_project_image_no_options()
test_remove_project_image_with_options()

Module contents