summaryrefslogtreecommitdiff
path: root/novaclient
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-08-31 22:07:08 +0000
committerGerrit Code Review <review@openstack.org>2015-08-31 22:07:08 +0000
commitfa0c063d53e90c9dadd19958ead0f7612eb38ff2 (patch)
tree64179163c9f1c684bcb1aad6272cac6964e4f887 /novaclient
parent7264f5555506bb623c9ec9b9150bbf422f6c82f9 (diff)
parent3f105a5989416db5b758caf17390784cfb9bfa94 (diff)
downloadpython-novaclient-fa0c063d53e90c9dadd19958ead0f7612eb38ff2.tar.gz
Merge "Add method for better random name"2.27.0
Diffstat (limited to 'novaclient')
-rw-r--r--novaclient/tests/functional/base.py10
-rw-r--r--novaclient/tests/functional/test_instances.py5
-rw-r--r--novaclient/tests/functional/test_volumes_api.py4
3 files changed, 12 insertions, 7 deletions
diff --git a/novaclient/tests/functional/base.py b/novaclient/tests/functional/base.py
index 7fc638b3..f39dbf0e 100644
--- a/novaclient/tests/functional/base.py
+++ b/novaclient/tests/functional/base.py
@@ -12,9 +12,11 @@
import os
import time
+import uuid
import fixtures
import os_client_config
+import six
import tempest_lib.cli.base
import testtools
@@ -190,3 +192,11 @@ class ClientTestBase(testtools.TestCase):
else:
self.fail("Volume %s did not reach status %s after %d s"
% (volume.id, status, timeout))
+
+ def name_generate(self, prefix='Entity'):
+ """Generate randomized name for some entity.
+
+ :param prefix: string prefix
+ """
+ name = "%s-%s" % (prefix, six.text_type(uuid.uuid4()))
+ return name
diff --git a/novaclient/tests/functional/test_instances.py b/novaclient/tests/functional/test_instances.py
index e937f186..749f34a7 100644
--- a/novaclient/tests/functional/test_instances.py
+++ b/novaclient/tests/functional/test_instances.py
@@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from novaclient.tests.functional import base
@@ -37,8 +35,7 @@ class TestInstanceCLI(base.ClientTestBase):
destroy.
"""
- # TODO(sdague): better random name
- name = str(uuid.uuid4())
+ name = self.name_generate('Instance')
# Boot via the cli, as we're primarily testing the cli in this test
network = self.client.networks.list()[0]
diff --git a/novaclient/tests/functional/test_volumes_api.py b/novaclient/tests/functional/test_volumes_api.py
index 7c921426..fcfd9f12 100644
--- a/novaclient/tests/functional/test_volumes_api.py
+++ b/novaclient/tests/functional/test_volumes_api.py
@@ -11,7 +11,6 @@
# under the License.
import time
-import uuid
import six.moves
@@ -75,8 +74,7 @@ class TestVolumesAPI(base.ClientTestBase):
self.client.servers.list()
# Create a volume type
- # TODO(melwitt): Use a better random name
- name = str(uuid.uuid4())
+ name = self.name_generate('VolumeType')
volume_type = self.client.volume_types.create(name)
# This cleanup tests volume type delete