diff options
| author | Akihiro Motoki <amotoki@gmail.com> | 2017-05-15 04:00:53 +0000 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2019-06-22 13:36:46 -0500 |
| commit | 8d63e3f0c38bbcc44db2e82a7e3d0ff5488d45af (patch) | |
| tree | 3b5e5f081097d6d96ca2701716c421bb70112b8f /openstackclient/tests/functional/image | |
| parent | 1a21f02bc7507120f3a4fe2af12ba7a27b002b44 (diff) | |
| download | python-openstackclient-8d63e3f0c38bbcc44db2e82a7e3d0ff5488d45af.tar.gz | |
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
Diffstat (limited to 'openstackclient/tests/functional/image')
| -rw-r--r-- | openstackclient/tests/functional/image/v1/test_image.py | 2 | ||||
| -rw-r--r-- | openstackclient/tests/functional/image/v2/test_image.py | 21 |
2 files changed, 9 insertions, 14 deletions
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): |
