Codebase list python-castellan / 34373ca
Replaces uuid.uuid4 with uuidutils.generate_uuid() Change-Id: I8ca34402bb5e8944062f2cb27cb840f0a2479dd2 Kiran_totad authored 6 years ago Kiran Totad committed 6 years ago
2 changed file(s) with 6 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
1818 Note: This requires local running instances of Barbican and Keystone.
1919 """
2020 import abc
21 import uuid
2221
2322 from keystoneauth1 import identity
2423 from keystoneauth1 import session
2524 from oslo_config import cfg
2625 from oslo_context import context
26 from oslo_utils import uuidutils
2727 from oslotest import base
2828
2929 from castellan.common.credentials import keystone_password
7474 self.key_mgr.delete, self.ctxt, None)
7575
7676 def test_delete_unknown_object(self):
77 unknown_uuid = str(uuid.uuid4())
77 unknown_uuid = uuidutils.generate_uuid()
7878 self.assertRaises(exception.ManagedObjectNotFoundError,
7979 self.key_mgr.delete, self.ctxt, unknown_uuid)
8080
9090 self.key_mgr.get, self.ctxt, None)
9191
9292 def test_get_unknown_key(self):
93 bad_key_uuid = str(uuid.uuid4())
93 bad_key_uuid = uuidutils.generate_uuid()
9494 self.assertRaises(exception.ManagedObjectNotFoundError,
9595 self.key_mgr.get, self.ctxt, bad_key_uuid)
9696
2828 import binascii
2929 import copy
3030 import random
31 import uuid
3231
3332 from cryptography.hazmat import backends
3433 from cryptography.hazmat.primitives.asymmetric import rsa
3534 from cryptography.hazmat.primitives import serialization
35 from oslo_utils import uuidutils
3636
3737 from castellan.common import exception
3838 from castellan.common.objects import private_key as pri_key
150150 return private_key_uuid, public_key_uuid
151151
152152 def _generate_key_id(self):
153 key_id = str(uuid.uuid4())
153 key_id = uuidutils.generate_uuid()
154154 while key_id in self.keys:
155 key_id = str(uuid.uuid4())
155 key_id = uuidutils.generate_uuid()
156156
157157 return key_id
158158