summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
authorTerryHowe <terrylhowe@gmail.com>2015-06-03 17:18:38 -0600
committerTerry Howe <terrylhowe@gmail.com>2015-06-16 12:34:00 +0000
commitce65164155dcf6dddf7695fbc5ca6352c121cc04 (patch)
treef3f95178e20c211192ed0d1b7a67a92d367ebb83 /openstackclient
parentdeb5a9790d07975b46107060c9f3ac02e4f502e7 (diff)
downloadpython-openstackclient-ce65164155dcf6dddf7695fbc5ca6352c121cc04.tar.gz
Add functional tests for image set
This patch includes functional tests for image set and it includes a change to use the OSC utils.format_dict method to format the properties. This will give a more user friendly format to the image commands and it gives a more consistent testable format to the output. Instead of: {u'a': u'b', u'c': u'd'} The user will see: a=b, c=d Change-Id: Ib396316586ffc5dbab231064d5b6dc9425507934
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/image/v1/image.py3
-rw-r--r--openstackclient/tests/image/v1/fakes.py6
2 files changed, 7 insertions, 2 deletions
diff --git a/openstackclient/image/v1/image.py b/openstackclient/image/v1/image.py
index d4d45fa2..85a9e076 100644
--- a/openstackclient/image/v1/image.py
+++ b/openstackclient/image/v1/image.py
@@ -275,6 +275,7 @@ class CreateImage(show.ShowOne):
info = {}
info.update(image._info)
+ info['properties'] = utils.format_dict(info.get('properties', {}))
return zip(*sorted(six.iteritems(info)))
@@ -608,6 +609,7 @@ class SetImage(show.ShowOne):
info = {}
info.update(image._info)
+ info['properties'] = utils.format_dict(info.get('properties', {}))
return zip(*sorted(six.iteritems(info)))
@@ -636,4 +638,5 @@ class ShowImage(show.ShowOne):
info = {}
info.update(image._info)
+ info['properties'] = utils.format_dict(info.get('properties', {}))
return zip(*sorted(six.iteritems(info)))
diff --git a/openstackclient/tests/image/v1/fakes.py b/openstackclient/tests/image/v1/fakes.py
index 972e6415..95a8a39c 100644
--- a/openstackclient/tests/image/v1/fakes.py
+++ b/openstackclient/tests/image/v1/fakes.py
@@ -30,7 +30,7 @@ image_properties = {
'Beta': 'b',
'Gamma': 'g',
}
-image_properties_str = "{'Alpha': 'a', 'Beta': 'b', 'Gamma': 'g'}"
+image_properties_str = "Alpha='a', Beta='b', Gamma='g'"
image_data = 'line 1\nline 2\n'
IMAGE = {
@@ -47,7 +47,9 @@ IMAGE = {
}
IMAGE_columns = tuple(sorted(IMAGE))
-IMAGE_data = tuple((IMAGE[x] for x in sorted(IMAGE)))
+IMAGE_output = dict(IMAGE)
+IMAGE_output['properties'] = image_properties_str
+IMAGE_data = tuple((IMAGE_output[x] for x in sorted(IMAGE_output)))
class FakeImagev1Client(object):