From 3e2f35f88e40720d3d837ba8ec6f6de1ae678226 Mon Sep 17 00:00:00 2001 From: M V P Nitesh Date: Mon, 15 May 2017 17:20:56 +0530 Subject: [PATCH] Replaces uuid.uuid4 with uuidutils.generate_uuid() Change-Id: I9a83e63622c352ea39bf43f7ae181cf8a696a999 Closes-Bug: #1082248 --- barbican/common/utils.py | 3 ++- barbican/model/repositories.py | 4 ++-- barbican/plugin/dogtag.py | 10 ++++----- barbican/plugin/snakeoil_ca.py | 3 ++- barbican/tests/api/controllers/test_acls.py | 6 +++--- barbican/tests/api/controllers/test_orders.py | 5 +++-- .../tests/api/controllers/test_secretmeta.py | 5 +++-- .../api/controllers/test_secretstores.py | 13 ++++++------ .../test_repositories_secret_stores.py | 8 ++++--- .../plugin/util/test_multiple_backends.py | 11 +++++----- .../tests/queue/test_keystone_listener.py | 21 ++++++++++--------- .../tests/tasks/test_keystone_consumer.py | 10 ++++----- barbican/tests/utils.py | 4 ++-- functionaltests/api/base.py | 4 ++-- .../api/v1/functional/test_quotas_rbac.py | 6 +++--- .../api/v1/functional/test_secretmeta.py | 8 ++++--- 16 files changed, 66 insertions(+), 55 deletions(-) diff --git a/barbican/common/utils.py b/barbican/common/utils.py index bc66cde60..0d507a121 100644 --- a/barbican/common/utils.py +++ b/barbican/common/utils.py @@ -22,6 +22,7 @@ import mimetypes import uuid from oslo_log import log +from oslo_utils import uuidutils import pecan import six from six.moves.urllib import parse @@ -182,7 +183,7 @@ def get_class_for(module_name, class_name): def generate_uuid(): - return str(uuid.uuid4()) + return uuidutils.generate_uuid() def is_multiple_backends_enabled(): diff --git a/barbican/model/repositories.py b/barbican/model/repositories.py index d8c87a8bc..2bd78c0e2 100644 --- a/barbican/model/repositories.py +++ b/barbican/model/repositories.py @@ -24,11 +24,11 @@ import logging import re import sys import time -import uuid from oslo_db import exception as db_exc from oslo_db.sqlalchemy import session from oslo_utils import timeutils +from oslo_utils import uuidutils import sqlalchemy from sqlalchemy import func as sa_func from sqlalchemy import or_ @@ -980,7 +980,7 @@ class KEKDatumRepo(BaseRepo): kek_datum = models.KEKDatum() kek_datum.kek_label = "project-{0}-key-{1}".format( - project.external_id, uuid.uuid4()) + project.external_id, uuidutils.generate_uuid()) kek_datum.project_id = project.id kek_datum.plugin_name = plugin_name kek_datum.status = models.States.ACTIVE diff --git a/barbican/plugin/dogtag.py b/barbican/plugin/dogtag.py index cc889ac99..a72503f66 100644 --- a/barbican/plugin/dogtag.py +++ b/barbican/plugin/dogtag.py @@ -17,7 +17,7 @@ import base64 import copy import datetime import os -import uuid +from oslo_utils import uuidutils from Crypto.PublicKey import RSA from Crypto.Util import asn1 @@ -202,7 +202,7 @@ class DogtagKRAPlugin(sstore.SecretStoreBase): the key_id """ data_type = key.KeyClient.PASS_PHRASE_TYPE - client_key_id = uuid.uuid4().hex + client_key_id = uuidutils.generate_uuid(dashed=False) if secret_dto.transport_key is not None: # TODO(alee-3) send the transport key with the archival request # once the Dogtag Client API changes. @@ -380,7 +380,7 @@ class DogtagKRAPlugin(sstore.SecretStoreBase): usages = [key.SymKeyGenerationRequest.DECRYPT_USAGE, key.SymKeyGenerationRequest.ENCRYPT_USAGE] - client_key_id = uuid.uuid4().hex + client_key_id = uuidutils.generate_uuid() algorithm = self._map_algorithm(key_spec.alg.lower()) if algorithm is None: @@ -420,7 +420,7 @@ class DogtagKRAPlugin(sstore.SecretStoreBase): usages = [key.AsymKeyGenerationRequest.DECRYPT_USAGE, key.AsymKeyGenerationRequest.ENCRYPT_USAGE] - client_key_id = uuid.uuid4().hex + client_key_id = uuidutils.generate_uuid() algorithm = self._map_algorithm(key_spec.alg.lower()) passphrase = key_spec.passphrase @@ -437,7 +437,7 @@ class DogtagKRAPlugin(sstore.SecretStoreBase): ) stored_passphrase_info = self.keyclient.archive_key( - uuid.uuid4().hex, + uuidutils.generate_uuid(), self.keyclient.PASS_PHRASE_TYPE, base64.b64encode(passphrase)) diff --git a/barbican/plugin/snakeoil_ca.py b/barbican/plugin/snakeoil_ca.py index 70fde78e9..0620ac0d6 100644 --- a/barbican/plugin/snakeoil_ca.py +++ b/barbican/plugin/snakeoil_ca.py @@ -24,6 +24,7 @@ import uuid from OpenSSL import crypto from oslo_config import cfg from oslo_utils import fnmatch +from oslo_utils import uuidutils from barbican.common import config from barbican.common import utils @@ -415,7 +416,7 @@ class SnakeoilCACertificatePlugin(cert_manager.CertificatePluginBase): "Invalid parent id passed to snake oil plugin:" + parent_ca_id) # create a new ca, passing in key and issuer from the parent - new_ca_id = str(uuid.uuid4()) + new_ca_id = uuidutils.generate_uuid() new_cert_path = os.path.join(self.subca_directory, new_ca_id + ".cert") new_key_path = os.path.join(self.subca_directory, new_ca_id + ".key") new_chain_path = os.path.join(self.subca_directory, diff --git a/barbican/tests/api/controllers/test_acls.py b/barbican/tests/api/controllers/test_acls.py index 6a4b5b383..6af48bca4 100644 --- a/barbican/tests/api/controllers/test_acls.py +++ b/barbican/tests/api/controllers/test_acls.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import os -import uuid +from oslo_utils import uuidutils from barbican.api.controllers import acls from barbican.model import repositories @@ -209,7 +209,7 @@ class WhenTestingSecretACLsResource(utils.BarbicanAPIBaseTestCase, read_user_ids=['u1', 'u3', 'u4']) resp = self.app.get( - '/secrets/{0}/acl'.format(uuid.uuid4().hex), + '/secrets/{0}/acl'.format(uuidutils.generate_uuid(dashed=False)), expect_errors=True) self.assertEqual(404, resp.status_int) @@ -679,7 +679,7 @@ class WhenTestingContainerAclsResource(utils.BarbicanAPIBaseTestCase, read_project_access=True) resp = self.app.get( - '/containers/{0}/acl'.format(uuid.uuid4().hex), + '/containers/{0}/acl'.format(uuidutils.generate_uuid()), expect_errors=True) self.assertEqual(404, resp.status_int) diff --git a/barbican/tests/api/controllers/test_orders.py b/barbican/tests/api/controllers/test_orders.py index 7b9d842a8..343b9b034 100644 --- a/barbican/tests/api/controllers/test_orders.py +++ b/barbican/tests/api/controllers/test_orders.py @@ -23,6 +23,7 @@ from barbican.model import repositories from barbican.tests.api.controllers import test_acls from barbican.tests.api import test_resources_policy as test_policy from barbican.tests import utils +from oslo_utils import uuidutils order_repo = repositories.get_order_repository() @@ -189,7 +190,7 @@ class WhenGettingOrDeletingOrders(utils.BarbicanAPIBaseTestCase): self.assertEqual(204, delete_resp.status_int) def test_get_call_on_non_existant_order_should_give_404(self): - bogus_uuid = uuid.uuid4() + bogus_uuid = uuidutils.generate_uuid() resp = self.app.get( '/orders/{0}'.format(bogus_uuid), expect_errors=True @@ -204,7 +205,7 @@ class WhenGettingOrDeletingOrders(utils.BarbicanAPIBaseTestCase): self.assertEqual(404, resp.status_int) def test_delete_call_on_non_existant_order_should_give_404(self): - bogus_uuid = uuid.uuid4() + bogus_uuid = uuidutils.generate_uuid() resp = self.app.delete( '/orders/{0}'.format(bogus_uuid), expect_errors=True diff --git a/barbican/tests/api/controllers/test_secretmeta.py b/barbican/tests/api/controllers/test_secretmeta.py index 5d48127d1..e947ef9cc 100644 --- a/barbican/tests/api/controllers/test_secretmeta.py +++ b/barbican/tests/api/controllers/test_secretmeta.py @@ -15,7 +15,7 @@ import json import mock import os -import uuid +from oslo_utils import uuidutils from barbican.tests import utils @@ -61,7 +61,8 @@ class WhenTestingSecretMetadataResource(utils.BarbicanAPIBaseTestCase): self.valid_metadata, secret_resp) - get_resp = self.app.get('/secrets/%s/metadata' % uuid.uuid4().hex, + get_resp = self.app.get('/secrets/%s/metadata' % + uuidutils.generate_uuid(dashed=False), expect_errors=True) self.assertEqual(404, get_resp.status_int) diff --git a/barbican/tests/api/controllers/test_secretstores.py b/barbican/tests/api/controllers/test_secretstores.py index 81ef0bdbc..a36e75b65 100644 --- a/barbican/tests/api/controllers/test_secretstores.py +++ b/barbican/tests/api/controllers/test_secretstores.py @@ -13,7 +13,7 @@ # under the License. import mock -import uuid +from oslo_utils import uuidutils from barbican.model import models from barbican.model import repositories as repos @@ -27,7 +27,8 @@ class SecretStoresMixin(utils.MultipleBackendsTestCase): session = repos.get_project_repository().get_session() project = models.Project() - project.external_id = "keystone_project_id" + uuid.uuid4().hex + project.external_id = ("keystone_project_id" + + uuidutils.generate_uuid(dashed=False)) project.save(session=session) return project @@ -254,7 +255,7 @@ class WhenTestingProjectSecretStore(utils.BarbicanAPIBaseTestCase, stores = self.secret_store_repo.get_all() - proj_external_id = uuid.uuid4().hex + proj_external_id = uuidutils.generate_uuid(dashed=False) # get ids as secret store are not bound to session after a rest call. store_ids = [store.id for store in stores] for store_id in store_ids: @@ -275,7 +276,7 @@ class WhenTestingProjectSecretStore(utils.BarbicanAPIBaseTestCase, stores = self.secret_store_repo.get_all() - proj_external_id = uuid.uuid4().hex + proj_external_id = uuidutils.generate_uuid(dashed=False) # get ids as secret store are not bound to session after a rest call. store_ids = [store.id for store in stores] for store_id in store_ids: @@ -300,7 +301,7 @@ class WhenTestingProjectSecretStore(utils.BarbicanAPIBaseTestCase, self._init_multiple_backends() stores = self.secret_store_repo.get_all() - proj_external_id = uuid.uuid4().hex + proj_external_id = uuidutils.generate_uuid(dashed=False) self.app.extra_environ = { 'barbican.context': self._build_context(proj_external_id) } @@ -314,7 +315,7 @@ class WhenTestingProjectSecretStore(utils.BarbicanAPIBaseTestCase, secret_stores = self.secret_store_repo.get_all() store_id = secret_stores[0].id - proj_external_id = uuid.uuid4().hex + proj_external_id = uuidutils.generate_uuid(dashed=False) self.app.extra_environ = { 'barbican.context': self._build_context(proj_external_id) diff --git a/barbican/tests/model/repositories/test_repositories_secret_stores.py b/barbican/tests/model/repositories/test_repositories_secret_stores.py index 9efb54337..555dc582e 100644 --- a/barbican/tests/model/repositories/test_repositories_secret_stores.py +++ b/barbican/tests/model/repositories/test_repositories_secret_stores.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import uuid +from oslo_utils import uuidutils from barbican.common import exception from barbican.model import models @@ -205,7 +205,8 @@ class WhenTestingProjectSecretStoreRepo(database_utils.RepositoryTestCase): session = self.proj_store_repo.get_session() project = models.Project() - project.external_id = "keystone_project_id" + uuid.uuid4().hex + project.external_id = ("keystone_project_id" + + uuidutils.generate_uuid(dashed=False)) project.save(session=session) return project @@ -359,7 +360,8 @@ class WhenTestingProjectSecretStoreRepo(database_utils.RepositoryTestCase): self.assertIsNone(returned_value) def test_get_project_entities(self): - entities = self.proj_store_repo.get_project_entities(uuid.uuid4().hex) + entities = self.proj_store_repo.get_project_entities( + uuidutils.generate_uuid(dashed=False)) self.assertEqual([], entities) def test_create_or_update_for_project(self): diff --git a/barbican/tests/plugin/util/test_multiple_backends.py b/barbican/tests/plugin/util/test_multiple_backends.py index b5c774c55..da69233fa 100644 --- a/barbican/tests/plugin/util/test_multiple_backends.py +++ b/barbican/tests/plugin/util/test_multiple_backends.py @@ -15,7 +15,7 @@ import collections import mock -import uuid +from oslo_utils import uuidutils from barbican.common import config from barbican.common import exception @@ -320,7 +320,7 @@ class TestGetApplicablePlugins(test_utils.MultipleBackendsTestCase): cr_plugins = ['cr_p1', 'cr_p2', 'cr_p3'] self.init_via_conf_file(ss_plugins, cr_plugins, enabled=True) ss_manager = MockedManager(ss_plugins) - project_id = uuid.uuid4().hex + project_id = uuidutils.generate_uuid(dashed=False) with mock.patch('barbican.model.repositories.ProjectSecretStoreRepo.' 'get_secret_store_for_project') as pref_func: @@ -344,7 +344,7 @@ class TestGetApplicablePlugins(test_utils.MultipleBackendsTestCase): self.init_via_conf_file(ss_plugins, cr_plugins, enabled=True) ss_manager = MockedManager(ss_plugins) - project_id = uuid.uuid4().hex + project_id = uuidutils.generate_uuid(dashed=False) with mock.patch('barbican.model.repositories.ProjectSecretStoreRepo.' 'get_secret_store_for_project') as pref_func: @@ -368,7 +368,7 @@ class TestGetApplicablePlugins(test_utils.MultipleBackendsTestCase): global_default_index=1) cr_manager = MockedManager(cr_plugins, plugin_lookup_field='crypto_plugin') - project_id = uuid.uuid4().hex + project_id = uuidutils.generate_uuid(dashed=False) with mock.patch('barbican.plugin.util.multiple_backends.' 'get_global_default_secret_store') as gd_func: @@ -443,7 +443,8 @@ class TestPluginsGenerateStoreAPIMultipleBackend( session = repositories.get_project_repository().get_session() project = models.Project() - project.external_id = "keystone_project_id" + uuid.uuid4().hex + project.external_id = ("keystone_project_id" + + uuidutils.generate_uuid(dashed=False)) project.save(session=session) return project diff --git a/barbican/tests/queue/test_keystone_listener.py b/barbican/tests/queue/test_keystone_listener.py index 0e8b89146..c44d29d51 100644 --- a/barbican/tests/queue/test_keystone_listener.py +++ b/barbican/tests/queue/test_keystone_listener.py @@ -12,7 +12,7 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. -import uuid +from oslo_utils import uuidutils import mock import oslo_messaging @@ -64,7 +64,8 @@ class WhenUsingNotificationTask(UtilMixin, utils.BaseTestCase): super(WhenUsingNotificationTask, self).setUp() self.task = keystone_listener.NotificationTask(self.conf) - self.payload = {'resource_info': uuid.uuid4().hex} + self.payload = {'resource_info': uuidutils.generate_uuid( + dashed=False)} self.type_index = 2 self.payload_index = 3 @@ -101,7 +102,7 @@ class WhenUsingNotificationTask(UtilMixin, utils.BaseTestCase): def test_delete_project_event_notification_with_required_data( self, mock_process): - project_id = uuid.uuid4().hex + project_id = uuidutils.generate_uuid(dashed=False) self.task_args[self.type_index] = 'identity.project.deleted' self.task_args[self.payload_index] = {'resource_info': project_id} result = self.task.info(*self.task_args) @@ -115,7 +116,7 @@ class WhenUsingNotificationTask(UtilMixin, utils.BaseTestCase): def test_delete_project_event_with_different_service_name_in_event_type( self, mock_process): - project_id = uuid.uuid4().hex + project_id = uuidutils.generate_uuid(dashed=False) self.task_args[self.type_index] = 'aaa.project.deleted' self.task_args[self.payload_index] = {'resource_info': project_id} result = self.task.info(*self.task_args) @@ -130,7 +131,7 @@ class WhenUsingNotificationTask(UtilMixin, utils.BaseTestCase): def test_delete_project_event_with_event_type_in_different_case( self, mock_process): - project_id = uuid.uuid4().hex + project_id = uuidutils.generate_uuid(dashed=False) self.task_args[self.type_index] = 'Identity.PROJECT.DeleteD' self.task_args[self.payload_index] = {'resource_info': project_id} result = self.task.info(*self.task_args) @@ -145,7 +146,7 @@ class WhenUsingNotificationTask(UtilMixin, utils.BaseTestCase): def test_delete_project_event_with_incomplete_event_type_format( self, mock_process): - project_id = uuid.uuid4().hex + project_id = uuidutils.generate_uuid(dashed=False) self.task_args[self.type_index] = 'project.deleted' self.task_args[self.payload_index] = {'resource_info': project_id} result = self.task.info(*self.task_args) @@ -200,7 +201,7 @@ class WhenUsingNotificationTask(UtilMixin, utils.BaseTestCase): return_value=None) def test_event_notification_with_missing_event_type(self, mock_process): - project_id = uuid.uuid4().hex + project_id = uuidutils.generate_uuid(dashed=False) self.task_args[self.type_index] = None self.task_args[self.payload_index] = {'resource_info': project_id} result = self.task.info(*self.task_args) @@ -214,7 +215,7 @@ class WhenUsingNotificationTask(UtilMixin, utils.BaseTestCase): return_value=None) def test_event_notification_with_blank_event_type(self, mock_process): - project_id = uuid.uuid4().hex + project_id = uuidutils.generate_uuid(dashed=False) self.task_args[self.type_index] = '' self.task_args[self.payload_index] = {'resource_info': project_id} result = self.task.info(*self.task_args) @@ -232,7 +233,7 @@ class WhenUsingNotificationTask(UtilMixin, utils.BaseTestCase): local_task = keystone_listener.NotificationTask(self.conf) mock_process.side_effect = Exception('Dummy Error') - project_id = uuid.uuid4().hex + project_id = uuidutils.generate_uuid(dashed=False) self.task_args[self.type_index] = 'identity.project.deleted' self.task_args[self.payload_index] = {'resource_info': project_id} result = local_task.info(*self.task_args) @@ -249,7 +250,7 @@ class WhenUsingNotificationTask(UtilMixin, utils.BaseTestCase): local_task = keystone_listener.NotificationTask(self.conf) mock_process.side_effect = Exception('Dummy Error') - project_id = uuid.uuid4().hex + project_id = uuidutils.generate_uuid(dashed=False) self.task_args[self.type_index] = 'identity.project.deleted' self.task_args[self.payload_index] = {'resource_info': project_id} result = local_task.info(*self.task_args) diff --git a/barbican/tests/tasks/test_keystone_consumer.py b/barbican/tests/tasks/test_keystone_consumer.py index f6002575a..efebb4760 100644 --- a/barbican/tests/tasks/test_keystone_consumer.py +++ b/barbican/tests/tasks/test_keystone_consumer.py @@ -12,7 +12,6 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. -import uuid import mock import sqlalchemy @@ -25,6 +24,7 @@ from barbican.plugin.crypto import manager from barbican.plugin import resources as plugin from barbican.tasks import keystone_consumer as consumer from barbican.tests import database_utils +from oslo_utils import uuidutils class InitializeDatabaseMixin(object): @@ -38,8 +38,8 @@ class InitializeDatabaseMixin(object): group='crypto', enforce_type=True) - self.project_id1 = uuid.uuid4().hex - self.project_id2 = uuid.uuid4().hex + self.project_id1 = uuidutils.generate_uuid() + self.project_id2 = uuidutils.generate_uuid(dashed=False) self.project1_data = c_resources.get_or_create_project( self.project_id1) @@ -51,8 +51,8 @@ class InitializeDatabaseMixin(object): def _create_secret_for_project(self, project_data): - secret_info = {"name": uuid.uuid4().hex, "algorithm": "aes", - "bit_length": 256, "mode": "cbc", + secret_info = {"name": uuidutils.generate_uuid(dashed=False), + "algorithm": "aes", "bit_length": 256, "mode": "cbc", "payload_content_type": "application/octet-stream"} new_secret = plugin.generate_secret( secret_info, secret_info.get('payload_content_type'), project_data) diff --git a/barbican/tests/utils.py b/barbican/tests/utils.py index d4674290c..1adf08b46 100644 --- a/barbican/tests/utils.py +++ b/barbican/tests/utils.py @@ -19,10 +19,10 @@ import os from os import path import time import types -import uuid import mock from oslo_config import cfg +from oslo_utils import uuidutils import oslotest.base as oslotest from oslotest import createfile @@ -642,7 +642,7 @@ def generate_test_uuid(tail_value=0): def generate_test_valid_uuid(): """Returns a valid uuid value, similar to uuid generated in barbican""" - return str(uuid.uuid4()) + return uuidutils.generate_uuid() def get_symmetric_key(): diff --git a/functionaltests/api/base.py b/functionaltests/api/base.py index c543d9fce..25721e6f3 100644 --- a/functionaltests/api/base.py +++ b/functionaltests/api/base.py @@ -17,7 +17,7 @@ import abc import fixtures import logging import os -import uuid +from oslo_utils import uuidutils import oslotest.base as oslotest import six @@ -99,7 +99,7 @@ class PagingTestCase(TestCase): super(PagingTestCase, self).tearDown() def _set_filter_field(self, model): - filter = str(uuid.uuid4()) + filter = uuidutils.generate_uuid() self.set_filter_field(filter, model) return filter diff --git a/functionaltests/api/v1/functional/test_quotas_rbac.py b/functionaltests/api/v1/functional/test_quotas_rbac.py index 0918c1370..c6c2d838c 100644 --- a/functionaltests/api/v1/functional/test_quotas_rbac.py +++ b/functionaltests/api/v1/functional/test_quotas_rbac.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import uuid +from oslo_utils import uuidutils from barbican.tests import utils from functionaltests.api import base @@ -143,7 +143,7 @@ class RBACQuotasTestCase(base.TestCase): """ request_model = quota_models.ProjectQuotaRequestModel( **get_set_project_quotas_request()) - project_id = str(uuid.uuid4()) + project_id = uuidutils.generate_uuid() resp = self.behaviors.set_project_quotas(project_id, request_model, user_name=user) @@ -162,7 +162,7 @@ class RBACQuotasTestCase(base.TestCase): """ request_model = quota_models.ProjectQuotaRequestModel( **get_set_project_quotas_request()) - project_id = str(uuid.uuid4()) + project_id = uuidutils.generate_uuid() resp = self.behaviors.set_project_quotas(project_id, request_model, user_name=service_admin) diff --git a/functionaltests/api/v1/functional/test_secretmeta.py b/functionaltests/api/v1/functional/test_secretmeta.py index e6425440b..827a47c0a 100644 --- a/functionaltests/api/v1/functional/test_secretmeta.py +++ b/functionaltests/api/v1/functional/test_secretmeta.py @@ -14,13 +14,13 @@ # limitations under the License. from oslo_serialization import jsonutils from testtools import testcase -import uuid from barbican.tests import utils from functionaltests.api import base from functionaltests.api.v1.behaviors import secret_behaviors from functionaltests.api.v1.behaviors import secretmeta_behaviors from functionaltests.api.v1.models import secret_models +from oslo_utils import uuidutils @utils.parameterized_test_case @@ -82,7 +82,8 @@ class SecretMetadataTestCase(base.TestCase): @testcase.attr('negative') def test_secret_metadata_create_no_secret(self): - secret_ref = 'http://localhost:9311/secrets/%s' % uuid.uuid4().hex + secret_ref = ('http://localhost:9311/secrets/%s' % + uuidutils.generate_uuid(dashed=False)) meta_resp, metadata_ref = self.behaviors.create_or_update_metadata( secret_ref, self.invalid_metadata) @@ -110,7 +111,8 @@ class SecretMetadataTestCase(base.TestCase): @testcase.attr('negative') def test_secret_metadata_get_no_secret(self): - secret_ref = 'http://localhost:9311/secrets/%s' % uuid.uuid4().hex + secret_ref = ('http://localhost:9311/secrets/%s' % + uuidutils.generate_uuid(dashed=False)) get_resp = self.behaviors.get_metadata(secret_ref) self.assertEqual(404, get_resp.status_code)