Merge "Replaces uuid.uuid4 with uuidutils.generate_uuid()"

This commit is contained in:
Jenkins 2017-06-30 10:09:48 +00:00 committed by Gerrit Code Review
commit 1b3f5f3f90
2 changed files with 6 additions and 6 deletions

View File

@ -19,12 +19,12 @@ Functional test cases for the Barbican key manager.
Note: This requires local running instances of Barbican and Keystone.
"""
import abc
import uuid
from keystoneauth1 import identity
from keystoneauth1 import session
from oslo_config import cfg
from oslo_context import context
from oslo_utils import uuidutils
from oslotest import base
from castellan.common.credentials import keystone_password
@ -75,7 +75,7 @@ class BarbicanKeyManagerTestCase(test_key_manager.KeyManagerTestCase):
self.key_mgr.delete, self.ctxt, None)
def test_delete_unknown_object(self):
unknown_uuid = str(uuid.uuid4())
unknown_uuid = uuidutils.generate_uuid()
self.assertRaises(exception.ManagedObjectNotFoundError,
self.key_mgr.delete, self.ctxt, unknown_uuid)
@ -91,7 +91,7 @@ class BarbicanKeyManagerTestCase(test_key_manager.KeyManagerTestCase):
self.key_mgr.get, self.ctxt, None)
def test_get_unknown_key(self):
bad_key_uuid = str(uuid.uuid4())
bad_key_uuid = uuidutils.generate_uuid()
self.assertRaises(exception.ManagedObjectNotFoundError,
self.key_mgr.get, self.ctxt, bad_key_uuid)

View File

@ -29,11 +29,11 @@ this class.
import binascii
import copy
import random
import uuid
from cryptography.hazmat import backends
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import serialization
from oslo_utils import uuidutils
from castellan.common import exception
from castellan.common.objects import private_key as pri_key
@ -151,9 +151,9 @@ class MockKeyManager(key_manager.KeyManager):
return private_key_uuid, public_key_uuid
def _generate_key_id(self):
key_id = str(uuid.uuid4())
key_id = uuidutils.generate_uuid()
while key_id in self.keys:
key_id = str(uuid.uuid4())
key_id = uuidutils.generate_uuid()
return key_id