From 8d63e3f0c38bbcc44db2e82a7e3d0ff5488d45af Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Mon, 15 May 2017 04:00:53 +0000 Subject: Use cliff formattable columns in image commands Related functional tests are converted into JSON format. Otherwise, it is not easy to check results. Partial-Bug: #1687955 Partially implement blueprint osc-formattable-columns Change-Id: Ib82e15738544975fede0c54cc5eaf239f4c67277 --- .../tests/functional/image/v1/test_image.py | 2 +- .../tests/functional/image/v2/test_image.py | 21 ++++++++------------- 2 files changed, 9 insertions(+), 14 deletions(-) (limited to 'openstackclient/tests/functional') diff --git a/openstackclient/tests/functional/image/v1/test_image.py b/openstackclient/tests/functional/image/v1/test_image.py index 30490bf5..b9774ab5 100644 --- a/openstackclient/tests/functional/image/v1/test_image.py +++ b/openstackclient/tests/functional/image/v1/test_image.py @@ -104,6 +104,6 @@ class ImageTests(base.BaseImageTests): self.name )) self.assertEqual( - "a='b', c='d'", + {'a': 'b', 'c': 'd'}, json_output["properties"], ) diff --git a/openstackclient/tests/functional/image/v2/test_image.py b/openstackclient/tests/functional/image/v2/test_image.py index 3185c3bd..264ba519 100644 --- a/openstackclient/tests/functional/image/v2/test_image.py +++ b/openstackclient/tests/functional/image/v2/test_image.py @@ -14,7 +14,6 @@ import json import uuid import fixtures -# from glanceclient import exc as image_exceptions from openstackclient.tests.functional.image import base @@ -81,7 +80,7 @@ class ImageTests(base.BaseImageTests): json_output = json.loads(self.openstack( 'image list --tag ' + self.image_tag + ' --long -f json' )) - for taglist in [img['Tags'].split(', ') for img in json_output]: + for taglist in [img['Tags'] for img in json_output]: self.assertIn( self.image_tag, taglist @@ -127,10 +126,8 @@ class ImageTests(base.BaseImageTests): 'image show -f json ' + self.name )) - # NOTE(dtroyer): Don't do a full-string compare so we are tolerant of - # new artributes in the returned data - self.assertIn("a='b'", json_output["properties"]) - self.assertIn("c='d'", json_output["properties"]) + self.assertIn("a", json_output["properties"]) + self.assertIn("c", json_output["properties"]) self.openstack( 'image unset ' + @@ -142,15 +139,13 @@ class ImageTests(base.BaseImageTests): 'image show -f json ' + self.name )) - # NOTE(dtroyer): Don't do a full-string compare so we are tolerant of - # new artributes in the returned data - self.assertNotIn("a='b'", json_output["properties"]) - self.assertNotIn("c='d'", json_output["properties"]) + self.assertNotIn("a", json_output["properties"]) + self.assertNotIn("c", json_output["properties"]) # Test tags self.assertNotIn( '01', - json_output["tags"].split(', ') + json_output["tags"] ) self.openstack( 'image set ' + @@ -163,7 +158,7 @@ class ImageTests(base.BaseImageTests): )) self.assertIn( '01', - json_output["tags"].split(', ') + json_output["tags"] ) self.openstack( @@ -177,7 +172,7 @@ class ImageTests(base.BaseImageTests): )) self.assertNotIn( '01', - json_output["tags"].split(', ') + json_output["tags"] ) def test_image_set_rename(self): -- cgit v1.2.1