Replace uuid.uuid4() with uuidutils.generate_uuid()

Openstack common has a wrapper for generating uuids.
We should use that function to generate uuids for consistency.

Change-Id: I726f0f2687945336c0e48c9f5a0897bd81a3b2b3
This commit is contained in:
rajat29 2017-07-20 15:34:08 +05:30
parent b1216b6b1e
commit adcea3ed8a
1 changed files with 9 additions and 7 deletions

View File

@ -15,10 +15,12 @@
import collections
import re
import sys
import uuid
import fixtures
import mock
from oslo_utils import uuidutils
import six
from stevedore import extension
import testtools
@ -172,7 +174,7 @@ class TestSolum(base.TestCase):
@mock.patch.object(pipeline.PipelineManager, "find")
def test_pipeline_delete(self, mock_pipeline_find, mock_pipeline_delete):
self.make_env()
the_id = str(uuid.uuid4())
the_id = uuidutils.generate_uuid()
self.shell("pipeline delete %s" % the_id)
mock_pipeline_find.assert_called_once_with(
name_or_id=the_id)
@ -181,7 +183,7 @@ class TestSolum(base.TestCase):
@mock.patch.object(pipeline.PipelineManager, "find")
def test_pipeline_get(self, mock_pipeline_find):
self.make_env()
the_id = str(uuid.uuid4())
the_id = uuidutils.generate_uuid()
self.shell("pipeline show %s" % the_id)
mock_pipeline_find.assert_called_once_with(name_or_id=the_id)
@ -354,7 +356,7 @@ class TestSolum(base.TestCase):
@mock.patch.object(plan.PlanManager, "find")
def test_plan_delete(self, mock_plan_find, mock_plan_delete):
self.make_env()
the_id = str(uuid.uuid4())
the_id = uuidutils.generate_uuid()
self.shell("plan delete %s" % the_id)
mock_plan_find.assert_called_once_with(name_or_id=the_id)
self.assertEqual(1, mock_plan_delete.call_count)
@ -362,14 +364,14 @@ class TestSolum(base.TestCase):
@mock.patch.object(plan.PlanManager, "find")
def test_plan_get(self, mock_plan_find):
self.make_env()
the_id = str(uuid.uuid4())
the_id = uuidutils.generate_uuid()
self.shell("plan show %s" % the_id)
mock_plan_find.assert_called_once_with(name_or_id=the_id)
@mock.patch.object(plan.PlanManager, "find")
def test_plan_get_private_github_repo(self, mock_plan_find):
self.make_env()
the_id = str(uuid.uuid4())
the_id = uuidutils.generate_uuid()
FakeResource = collections.namedtuple(
"FakeResource", "uuid name description uri artifacts")
mock_plan_find.return_value = FakeResource('foo', 'foo', 'foo', 'foo',
@ -426,7 +428,7 @@ class TestSolum(base.TestCase):
@mock.patch.object(component.ComponentManager, "find")
def test_component_get(self, mock_component_find):
self.make_env()
the_id = str(uuid.uuid4())
the_id = uuidutils.generate_uuid()
self.shell("component show %s" % the_id)
mock_component_find.assert_called_once_with(name_or_id=the_id)