Stop using uuid in functional tests

Some functional tests were using the uuid library for unique
names. The testing framework provides us a method, getUniqueString(),
for just such a thing, so we should use that instead.

Change-Id: I08b8ef91b9cd467ade9fac1a73a5bd8976e207ed
This commit is contained in:
David Shrewsbury
2015-11-16 10:14:03 -05:00
parent a70fcf7b2c
commit 21438f412f
2 changed files with 2 additions and 4 deletions

View File

@@ -20,7 +20,6 @@ Functional tests for `shade` image methods.
"""
import tempfile
import uuid
from shade import openstack_cloud
from shade.tests import base
@@ -37,7 +36,7 @@ class TestImage(base.TestCase):
test_image = tempfile.NamedTemporaryFile(delete=False)
test_image.write('\0' * 1024 * 1024)
test_image.close()
image_name = 'test-image-%s' % uuid.uuid4()
image_name = self.getUniqueString('image')
try:
self.cloud.create_image(name=image_name,
filename=test_image.name,

View File

@@ -20,7 +20,6 @@ Functional tests for `shade` object methods.
"""
import tempfile
import uuid
from testtools import content
@@ -38,7 +37,7 @@ class TestObject(base.TestCase):
def test_create_object(self):
'''Test uploading small and large files.'''
container_name = str(uuid.uuid4())
container_name = self.getUniqueString('container')
self.addDetail('container', content.text_content(container_name))
self.addCleanup(self.cloud.delete_container, container_name)
self.cloud.create_container(container_name)