summaryrefslogtreecommitdiff
path: root/functional/tests/image
diff options
context:
space:
mode:
authorKyrylo Romanenko <kromanenko@mirantis.com>2016-07-05 12:16:18 +0300
committerSteve Martinelli <s.martinelli@gmail.com>2016-07-05 15:39:03 +0000
commit259b4a14628b5eae5f9154a052381145e7e7ba1e (patch)
treef3449aa2857717436e1b4128a6e713a60f566783 /functional/tests/image
parent44d4188149faa53d377adf6af6a64a1f6403ce43 (diff)
downloadpython-openstackclient-259b4a14628b5eae5f9154a052381145e7e7ba1e.tar.gz
Deduplicate get_opts methods
One get_opts method can work instead of get_list_opts and get_show_opts both. Remove mutable default value. Change-Id: I9c5683d416f0f3ed4989abab6f152b0341e30a4f
Diffstat (limited to 'functional/tests/image')
-rw-r--r--functional/tests/image/v1/test_image.py10
-rw-r--r--functional/tests/image/v2/test_image.py12
2 files changed, 11 insertions, 11 deletions
diff --git a/functional/tests/image/v1/test_image.py b/functional/tests/image/v1/test_image.py
index fe61f830..c64c0d98 100644
--- a/functional/tests/image/v1/test_image.py
+++ b/functional/tests/image/v1/test_image.py
@@ -27,7 +27,7 @@ class ImageTests(test.TestCase):
@classmethod
def setUpClass(cls):
os.environ['OS_IMAGE_API_VERSION'] = '1'
- opts = cls.get_show_opts(cls.FIELDS)
+ opts = cls.get_opts(cls.FIELDS)
raw_output = cls.openstack('image create ' + cls.NAME + opts)
expected = cls.NAME + '\n'
cls.assertOutput(expected, raw_output)
@@ -43,17 +43,17 @@ class ImageTests(test.TestCase):
cls.assertOutput('', raw_output)
def test_image_list(self):
- opts = self.get_list_opts(self.HEADERS)
+ opts = self.get_opts(self.HEADERS)
raw_output = self.openstack('image list' + opts)
self.assertIn(self.NAME, raw_output)
def test_image_show(self):
- opts = self.get_show_opts(self.FIELDS)
+ opts = self.get_opts(self.FIELDS)
raw_output = self.openstack('image show ' + self.NAME + opts)
self.assertEqual(self.NAME + "\n", raw_output)
def test_image_set(self):
- opts = self.get_show_opts([
+ opts = self.get_opts([
"disk_format", "is_public", "min_disk", "min_ram", "name"])
self.openstack('image set --min-disk 4 --min-ram 5 ' +
'--disk-format qcow2 --public ' + self.NAME)
@@ -61,7 +61,7 @@ class ImageTests(test.TestCase):
self.assertEqual("qcow2\nTrue\n4\n5\n" + self.NAME + '\n', raw_output)
def test_image_metadata(self):
- opts = self.get_show_opts(["name", "properties"])
+ opts = self.get_opts(["name", "properties"])
self.openstack('image set --property a=b --property c=d ' + self.NAME)
raw_output = self.openstack('image show ' + self.NAME + opts)
self.assertEqual(self.NAME + "\na='b', c='d'\n", raw_output)
diff --git a/functional/tests/image/v2/test_image.py b/functional/tests/image/v2/test_image.py
index 2e2b59bb..c2524f8a 100644
--- a/functional/tests/image/v2/test_image.py
+++ b/functional/tests/image/v2/test_image.py
@@ -29,7 +29,7 @@ class ImageTests(test.TestCase):
@classmethod
def setUpClass(cls):
os.environ['OS_IMAGE_API_VERSION'] = '2'
- opts = cls.get_show_opts(cls.FIELDS)
+ opts = cls.get_opts(cls.FIELDS)
raw_output = cls.openstack('image create ' + cls.NAME + opts)
expected = cls.NAME + '\n'
cls.assertOutput(expected, raw_output)
@@ -45,17 +45,17 @@ class ImageTests(test.TestCase):
cls.assertOutput('', raw_output)
def test_image_list(self):
- opts = self.get_list_opts(self.HEADERS)
+ opts = self.get_opts(self.HEADERS)
raw_output = self.openstack('image list' + opts)
self.assertIn(self.NAME, raw_output)
def test_image_show(self):
- opts = self.get_show_opts(self.FIELDS)
+ opts = self.get_opts(self.FIELDS)
raw_output = self.openstack('image show ' + self.NAME + opts)
self.assertEqual(self.NAME + "\n", raw_output)
def test_image_set(self):
- opts = self.get_show_opts([
+ opts = self.get_opts([
"disk_format", "visibility", "min_disk", "min_ram", "name"])
self.openstack('image set --min-disk 4 --min-ram 5 ' +
'--public ' + self.NAME)
@@ -63,14 +63,14 @@ class ImageTests(test.TestCase):
self.assertEqual("raw\n4\n5\n" + self.NAME + '\npublic\n', raw_output)
def test_image_metadata(self):
- opts = self.get_show_opts(["name", "properties"])
+ opts = self.get_opts(["name", "properties"])
self.openstack('image set --property a=b --property c=d ' + self.NAME)
raw_output = self.openstack('image show ' + self.NAME + opts)
self.assertEqual(self.NAME + "\na='b', c='d'\n", raw_output)
@testtools.skip("skip until bug 1596573 is resolved")
def test_image_unset(self):
- opts = self.get_show_opts(["name", "tags", "properties"])
+ opts = self.get_opts(["name", "tags", "properties"])
self.openstack('image set --tag 01 ' + self.NAME)
self.openstack('image unset --tag 01 ' + self.NAME)
# test_image_metadata has set image properties "a" and "c"