summaryrefslogtreecommitdiff
path: root/openstackclient/tests/functional/image/v1/test_image.py
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-08-07 14:45:27 +0000
committerGerrit Code Review <review@openstack.org>2018-08-07 14:45:27 +0000
commit8e3eef2946f37e52d5d63cb5667b720ab4678a0d (patch)
tree20a50554d9a17c22f79d6f18f0bda3cfc20448b6 /openstackclient/tests/functional/image/v1/test_image.py
parent2b62b6e6ecb5fbb6d3078a3f7737364e13ec4e6c (diff)
parentdef83a0e94de2f98e3bd68ee412c0f0a2c316f32 (diff)
downloadpython-openstackclient-8e3eef2946f37e52d5d63cb5667b720ab4678a0d.tar.gz
Merge "Fix broken gate jobs"
Diffstat (limited to 'openstackclient/tests/functional/image/v1/test_image.py')
-rw-r--r--openstackclient/tests/functional/image/v1/test_image.py55
1 files changed, 26 insertions, 29 deletions
diff --git a/openstackclient/tests/functional/image/v1/test_image.py b/openstackclient/tests/functional/image/v1/test_image.py
index fa073f99..30490bf5 100644
--- a/openstackclient/tests/functional/image/v1/test_image.py
+++ b/openstackclient/tests/functional/image/v1/test_image.py
@@ -15,50 +15,47 @@ import uuid
import fixtures
-from openstackclient.tests.functional import base
+from openstackclient.tests.functional.image import base
-class ImageTests(base.TestCase):
- """Functional tests for image. """
+class ImageTests(base.BaseImageTests):
+ """Functional tests for Image commands"""
- NAME = uuid.uuid4().hex
- OTHER_NAME = uuid.uuid4().hex
+ def setUp(self):
+ super(ImageTests, self).setUp()
+ if not self.haz_v1_api:
+ self.skipTest('No Image v1 API present')
- @classmethod
- def setUpClass(cls):
- super(ImageTests, cls).setUpClass()
- json_output = json.loads(cls.openstack(
+ self.name = uuid.uuid4().hex
+ json_output = json.loads(self.openstack(
'--os-image-api-version 1 '
'image create -f json ' +
- cls.NAME
+ self.name
))
- cls.image_id = json_output["id"]
- cls.assertOutput(cls.NAME, json_output['name'])
+ self.image_id = json_output["id"]
+ self.assertOutput(self.name, json_output['name'])
+
+ ver_fixture = fixtures.EnvironmentVariable(
+ 'OS_IMAGE_API_VERSION', '1'
+ )
+ self.useFixture(ver_fixture)
- @classmethod
- def tearDownClass(cls):
+ def tearDown(self):
try:
- cls.openstack(
+ self.openstack(
'--os-image-api-version 1 '
'image delete ' +
- cls.image_id
+ self.image_id
)
finally:
- super(ImageTests, cls).tearDownClass()
-
- def setUp(self):
- super(ImageTests, self).setUp()
- ver_fixture = fixtures.EnvironmentVariable(
- 'OS_IMAGE_API_VERSION', '1'
- )
- self.useFixture(ver_fixture)
+ super(ImageTests, self).tearDown()
def test_image_list(self):
json_output = json.loads(self.openstack(
'image list -f json '
))
self.assertIn(
- self.NAME,
+ self.name,
[img['Name'] for img in json_output]
)
@@ -72,11 +69,11 @@ class ImageTests(base.TestCase):
'--min-ram 5 ' +
'--disk-format qcow2 ' +
'--public ' +
- self.NAME
+ self.name
)
json_output = json.loads(self.openstack(
'image show -f json ' +
- self.NAME
+ self.name
))
self.assertEqual(
4,
@@ -100,11 +97,11 @@ class ImageTests(base.TestCase):
'--property a=b ' +
'--property c=d ' +
'--public ' +
- self.NAME
+ self.name
)
json_output = json.loads(self.openstack(
'image show -f json ' +
- self.NAME
+ self.name
))
self.assertEqual(
"a='b', c='d'",