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:
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user