summaryrefslogtreecommitdiff
path: root/openstackclient/tests/image/v1/fakes.py
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2014-05-08 11:09:22 -0500
committerSteve Martinelli <stevemar@ca.ibm.com>2014-06-16 23:30:46 -0400
commit6380b8b95918a42cee63c21b90f7d8d55854d0c8 (patch)
tree0d43f2848f679cb579a83c6b66a066e6d60cd5e2 /openstackclient/tests/image/v1/fakes.py
parentaba1fb2268b3e5a2c785742861d7ae086b18e9a7 (diff)
downloadpython-openstackclient-6380b8b95918a42cee63c21b90f7d8d55854d0c8.tar.gz
Image create and set command updates and tests
Refactor image create and set commands to properly handle properties. This is particularly tricky with exclusive booleans as in this case leaving both choices off the command line should NOT assume a default value but leave the existing value unchanged. Properties were not being updated correctly in the 'image set' command. Refactor it to use the same pattern as in other SetXxx commands. Add tests for arg handling. Change-Id: I123a64c9b4feecab25a3e2013cc047f55b1c9967
Diffstat (limited to 'openstackclient/tests/image/v1/fakes.py')
-rw-r--r--openstackclient/tests/image/v1/fakes.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/openstackclient/tests/image/v1/fakes.py b/openstackclient/tests/image/v1/fakes.py
index ea2af84c..972e6415 100644
--- a/openstackclient/tests/image/v1/fakes.py
+++ b/openstackclient/tests/image/v1/fakes.py
@@ -17,16 +17,38 @@ import mock
from openstackclient.tests import fakes
from openstackclient.tests import utils
+from openstackclient.tests.volume.v1 import fakes as volume_fakes
image_id = 'im1'
image_name = 'graven'
+image_owner = 'baal'
+image_protected = False
+image_public = True
+image_properties = {
+ 'Alpha': 'a',
+ 'Beta': 'b',
+ 'Gamma': 'g',
+}
+image_properties_str = "{'Alpha': 'a', 'Beta': 'b', 'Gamma': 'g'}"
+image_data = 'line 1\nline 2\n'
IMAGE = {
'id': image_id,
- 'name': image_name
+ 'name': image_name,
+ 'container_format': '',
+ 'disk_format': '',
+ 'owner': image_owner,
+ 'min_disk': 0,
+ 'min_ram': 0,
+ 'is_public': image_public,
+ 'protected': image_protected,
+ 'properties': image_properties,
}
+IMAGE_columns = tuple(sorted(IMAGE))
+IMAGE_data = tuple((IMAGE[x] for x in sorted(IMAGE)))
+
class FakeImagev1Client(object):
def __init__(self, **kwargs):
@@ -44,3 +66,7 @@ class TestImagev1(utils.TestCommand):
endpoint=fakes.AUTH_URL,
token=fakes.AUTH_TOKEN,
)
+ self.app.client_manager.volume = volume_fakes.FakeVolumev1Client(
+ endpoint=fakes.AUTH_URL,
+ token=fakes.AUTH_TOKEN,
+ )