Replaces uuid.uuid4 with uuidutils.generate_uuid()
Openstack oslo_utils has a generate_uuid function for generating uuids. We should use that function when generating uuids for consistency. Change-Id: Ifa1c63d7c1aa7859458c42cbe6e56245c393c749
This commit is contained in:
parent
3e19ace698
commit
1c982ed19f
@ -14,7 +14,6 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import ddt
|
import ddt
|
||||||
import uuid
|
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
@ -23,6 +22,8 @@ from distilclient import exceptions
|
|||||||
from distilclient.tests.unit import utils
|
from distilclient.tests.unit import utils
|
||||||
from distilclient.v2 import client
|
from distilclient.v2 import client
|
||||||
|
|
||||||
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
|
|
||||||
@ddt.ddt
|
@ddt.ddt
|
||||||
class ClientTest(utils.TestCase):
|
class ClientTest(utils.TestCase):
|
||||||
@ -37,7 +38,7 @@ class ClientTest(utils.TestCase):
|
|||||||
def test_adapter_properties(self):
|
def test_adapter_properties(self):
|
||||||
# sample of properties, there are many more
|
# sample of properties, there are many more
|
||||||
retries = 3
|
retries = 3
|
||||||
base_url = uuid.uuid4().hex
|
base_url = uuidutils.generate_uuid()
|
||||||
|
|
||||||
s = client.session.Session()
|
s = client.session.Session()
|
||||||
c = client.Client(session=s,
|
c = client.Client(session=s,
|
||||||
@ -55,7 +56,7 @@ class ClientTest(utils.TestCase):
|
|||||||
|
|
||||||
def test_auth_via_token_and_session(self):
|
def test_auth_via_token_and_session(self):
|
||||||
s = client.session.Session()
|
s = client.session.Session()
|
||||||
base_url = uuid.uuid4().hex
|
base_url = uuidutils.generate_uuid()
|
||||||
c = client.Client(input_auth_token='token',
|
c = client.Client(input_auth_token='token',
|
||||||
distil_url=base_url, session=s,
|
distil_url=base_url, session=s,
|
||||||
api_version=distilclient.API_MAX_VERSION)
|
api_version=distilclient.API_MAX_VERSION)
|
||||||
@ -64,7 +65,7 @@ class ClientTest(utils.TestCase):
|
|||||||
self.assertIsNone(c.keystone_client)
|
self.assertIsNone(c.keystone_client)
|
||||||
|
|
||||||
def test_auth_via_token(self):
|
def test_auth_via_token(self):
|
||||||
base_url = uuid.uuid4().hex
|
base_url = uuidutils.generate_uuid()
|
||||||
|
|
||||||
c = client.Client(input_auth_token='token',
|
c = client.Client(input_auth_token='token',
|
||||||
distil_url=base_url,
|
distil_url=base_url,
|
||||||
|
@ -14,13 +14,14 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import uuid
|
|
||||||
|
|
||||||
import distilclient
|
import distilclient
|
||||||
from distilclient import base
|
from distilclient import base
|
||||||
from distilclient.tests.unit import utils
|
from distilclient.tests.unit import utils
|
||||||
from distilclient.v2 import client
|
from distilclient.v2 import client
|
||||||
|
|
||||||
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
|
|
||||||
class InvoicesTest(utils.TestCase):
|
class InvoicesTest(utils.TestCase):
|
||||||
|
|
||||||
@ -28,7 +29,8 @@ class InvoicesTest(utils.TestCase):
|
|||||||
super(InvoicesTest, self).setUp()
|
super(InvoicesTest, self).setUp()
|
||||||
self.client = client.Client(session=client.session.Session(),
|
self.client = client.Client(session=client.session.Session(),
|
||||||
api_version=distilclient.API_MAX_VERSION,
|
api_version=distilclient.API_MAX_VERSION,
|
||||||
distil_url=uuid.uuid4().hex, retries=3,
|
distil_url=uuidutils.generate_uuid(),
|
||||||
|
retries=3,
|
||||||
input_auth_token='token')
|
input_auth_token='token')
|
||||||
|
|
||||||
@mock.patch.object(base.Manager, '_list')
|
@mock.patch.object(base.Manager, '_list')
|
||||||
|
@ -14,13 +14,14 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import uuid
|
|
||||||
|
|
||||||
import distilclient
|
import distilclient
|
||||||
from distilclient import base
|
from distilclient import base
|
||||||
from distilclient.tests.unit import utils
|
from distilclient.tests.unit import utils
|
||||||
from distilclient.v2 import client
|
from distilclient.v2 import client
|
||||||
|
|
||||||
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
|
|
||||||
class HealthTest(utils.TestCase):
|
class HealthTest(utils.TestCase):
|
||||||
|
|
||||||
@ -28,7 +29,8 @@ class HealthTest(utils.TestCase):
|
|||||||
super(HealthTest, self).setUp()
|
super(HealthTest, self).setUp()
|
||||||
self.client = client.Client(session=client.session.Session(),
|
self.client = client.Client(session=client.session.Session(),
|
||||||
api_version=distilclient.API_MAX_VERSION,
|
api_version=distilclient.API_MAX_VERSION,
|
||||||
distil_url=uuid.uuid4().hex, retries=3,
|
distil_url=uuidutils.generate_uuid(),
|
||||||
|
retries=3,
|
||||||
input_auth_token='token')
|
input_auth_token='token')
|
||||||
|
|
||||||
@mock.patch.object(base.Manager, '_list')
|
@mock.patch.object(base.Manager, '_list')
|
||||||
|
@ -14,13 +14,14 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import uuid
|
|
||||||
|
|
||||||
import distilclient
|
import distilclient
|
||||||
from distilclient import base
|
from distilclient import base
|
||||||
from distilclient.tests.unit import utils
|
from distilclient.tests.unit import utils
|
||||||
from distilclient.v2 import client
|
from distilclient.v2 import client
|
||||||
|
|
||||||
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
|
|
||||||
class InvoicesTest(utils.TestCase):
|
class InvoicesTest(utils.TestCase):
|
||||||
|
|
||||||
@ -28,7 +29,8 @@ class InvoicesTest(utils.TestCase):
|
|||||||
super(InvoicesTest, self).setUp()
|
super(InvoicesTest, self).setUp()
|
||||||
self.client = client.Client(session=client.session.Session(),
|
self.client = client.Client(session=client.session.Session(),
|
||||||
api_version=distilclient.API_MAX_VERSION,
|
api_version=distilclient.API_MAX_VERSION,
|
||||||
distil_url=uuid.uuid4().hex, retries=3,
|
distil_url=uuidutils.generate_uuid(),
|
||||||
|
retries=3,
|
||||||
input_auth_token='token')
|
input_auth_token='token')
|
||||||
|
|
||||||
@mock.patch.object(base.Manager, '_list')
|
@mock.patch.object(base.Manager, '_list')
|
||||||
|
@ -14,13 +14,14 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import uuid
|
|
||||||
|
|
||||||
import distilclient
|
import distilclient
|
||||||
from distilclient import base
|
from distilclient import base
|
||||||
from distilclient.tests.unit import utils
|
from distilclient.tests.unit import utils
|
||||||
from distilclient.v2 import client
|
from distilclient.v2 import client
|
||||||
|
|
||||||
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
|
|
||||||
class MeasurementsTest(utils.TestCase):
|
class MeasurementsTest(utils.TestCase):
|
||||||
|
|
||||||
@ -29,7 +30,8 @@ class MeasurementsTest(utils.TestCase):
|
|||||||
|
|
||||||
self.client = client.Client(session=client.session.Session(),
|
self.client = client.Client(session=client.session.Session(),
|
||||||
api_version=distilclient.API_MAX_VERSION,
|
api_version=distilclient.API_MAX_VERSION,
|
||||||
distil_url=uuid.uuid4().hex, retries=3,
|
distil_url=uuidutils.generate_uuid(),
|
||||||
|
retries=3,
|
||||||
input_auth_token='token')
|
input_auth_token='token')
|
||||||
|
|
||||||
@mock.patch.object(base.Manager, '_list')
|
@mock.patch.object(base.Manager, '_list')
|
||||||
|
@ -14,13 +14,14 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import uuid
|
|
||||||
|
|
||||||
import distilclient
|
import distilclient
|
||||||
from distilclient import base
|
from distilclient import base
|
||||||
from distilclient.tests.unit import utils
|
from distilclient.tests.unit import utils
|
||||||
from distilclient.v2 import client
|
from distilclient.v2 import client
|
||||||
|
|
||||||
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
|
|
||||||
class ProductsTest(utils.TestCase):
|
class ProductsTest(utils.TestCase):
|
||||||
|
|
||||||
@ -28,7 +29,8 @@ class ProductsTest(utils.TestCase):
|
|||||||
super(ProductsTest, self).setUp()
|
super(ProductsTest, self).setUp()
|
||||||
self.client = client.Client(session=client.session.Session(),
|
self.client = client.Client(session=client.session.Session(),
|
||||||
api_version=distilclient.API_MAX_VERSION,
|
api_version=distilclient.API_MAX_VERSION,
|
||||||
distil_url=uuid.uuid4().hex, retries=3,
|
distil_url=uuidutils.generate_uuid(),
|
||||||
|
retries=3,
|
||||||
input_auth_token='token')
|
input_auth_token='token')
|
||||||
|
|
||||||
@mock.patch.object(base.Manager, '_list')
|
@mock.patch.object(base.Manager, '_list')
|
||||||
|
@ -14,13 +14,14 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import uuid
|
|
||||||
|
|
||||||
import distilclient
|
import distilclient
|
||||||
from distilclient import base
|
from distilclient import base
|
||||||
from distilclient.tests.unit import utils
|
from distilclient.tests.unit import utils
|
||||||
from distilclient.v2 import client
|
from distilclient.v2 import client
|
||||||
|
|
||||||
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
|
|
||||||
class QuotationsTest(utils.TestCase):
|
class QuotationsTest(utils.TestCase):
|
||||||
|
|
||||||
@ -28,7 +29,8 @@ class QuotationsTest(utils.TestCase):
|
|||||||
super(QuotationsTest, self).setUp()
|
super(QuotationsTest, self).setUp()
|
||||||
self.client = client.Client(session=client.session.Session(),
|
self.client = client.Client(session=client.session.Session(),
|
||||||
api_version=distilclient.API_MAX_VERSION,
|
api_version=distilclient.API_MAX_VERSION,
|
||||||
distil_url=uuid.uuid4().hex, retries=3,
|
distil_url=uuidutils.generate_uuid(),
|
||||||
|
retries=3,
|
||||||
input_auth_token='token')
|
input_auth_token='token')
|
||||||
|
|
||||||
@mock.patch.object(base.Manager, '_list')
|
@mock.patch.object(base.Manager, '_list')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user