summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit/image/v1/fakes.py
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient/tests/unit/image/v1/fakes.py')
-rw-r--r--openstackclient/tests/unit/image/v1/fakes.py74
1 files changed, 33 insertions, 41 deletions
diff --git a/openstackclient/tests/unit/image/v1/fakes.py b/openstackclient/tests/unit/image/v1/fakes.py
index 59ae5f7a..3097a42f 100644
--- a/openstackclient/tests/unit/image/v1/fakes.py
+++ b/openstackclient/tests/unit/image/v1/fakes.py
@@ -22,10 +22,6 @@ from openstackclient.tests.unit import utils
from openstackclient.tests.unit.volume.v1 import fakes as volume_fakes
-image_id = 'im1'
-image_name = 'graven'
-
-
class FakeImagev1Client(object):
def __init__(self, **kwargs):
@@ -51,40 +47,36 @@ class TestImagev1(utils.TestCommand):
)
-class FakeImage(object):
- """Fake one or more images."""
-
- @staticmethod
- def create_one_image(attrs=None):
- """Create a fake image.
-
- :param Dictionary attrs:
- A dictionary with all attrbutes of image
- :return:
- A FakeResource object with id, name, owner, protected,
- visibility and tags attrs
- """
- attrs = attrs or {}
-
- # Set default attribute
- image_info = {
- 'id': str(uuid.uuid4()),
- 'name': 'image-name' + uuid.uuid4().hex,
- 'owner': 'image-owner' + uuid.uuid4().hex,
- 'container_format': '',
- 'disk_format': '',
- 'min_disk': 0,
- 'min_ram': 0,
- 'is_public': True,
- 'protected': False,
- 'properties': {
- 'Alpha': 'a',
- 'Beta': 'b',
- 'Gamma': 'g'},
- 'status': 'status' + uuid.uuid4().hex
- }
-
- # Overwrite default attributes if there are some attributes set
- image_info.update(attrs)
-
- return image.Image(**image_info)
+def create_one_image(attrs=None):
+ """Create a fake image.
+
+ :param Dictionary attrs:
+ A dictionary with all attrbutes of image
+ :return:
+ A FakeResource object with id, name, owner, protected,
+ visibility and tags attrs
+ """
+ attrs = attrs or {}
+
+ # Set default attribute
+ image_info = {
+ 'id': str(uuid.uuid4()),
+ 'name': 'image-name' + uuid.uuid4().hex,
+ 'owner': 'image-owner' + uuid.uuid4().hex,
+ 'container_format': '',
+ 'disk_format': '',
+ 'min_disk': 0,
+ 'min_ram': 0,
+ 'is_public': True,
+ 'protected': False,
+ 'properties': {
+ 'Alpha': 'a',
+ 'Beta': 'b',
+ 'Gamma': 'g'},
+ 'status': 'status' + uuid.uuid4().hex
+ }
+
+ # Overwrite default attributes if there are some attributes set
+ image_info.update(attrs)
+
+ return image.Image(**image_info)