Merge "Replaces uuid.uuid4 with uuidutils.generate_uuid()"
Jenkins authored 6 years ago
Gerrit Code Review committed 6 years ago
18 | 18 |
Note: This requires local running instances of Barbican and Keystone.
|
19 | 19 |
"""
|
20 | 20 |
import abc
|
21 | |
import uuid
|
22 | 21 |
|
23 | 22 |
from keystoneauth1 import identity
|
24 | 23 |
from keystoneauth1 import session
|
25 | 24 |
from oslo_config import cfg
|
26 | 25 |
from oslo_context import context
|
|
26 |
from oslo_utils import uuidutils
|
27 | 27 |
from oslotest import base
|
28 | 28 |
|
29 | 29 |
from castellan.common.credentials import keystone_password
|
|
74 | 74 |
self.key_mgr.delete, self.ctxt, None)
|
75 | 75 |
|
76 | 76 |
def test_delete_unknown_object(self):
|
77 | |
unknown_uuid = str(uuid.uuid4())
|
|
77 |
unknown_uuid = uuidutils.generate_uuid()
|
78 | 78 |
self.assertRaises(exception.ManagedObjectNotFoundError,
|
79 | 79 |
self.key_mgr.delete, self.ctxt, unknown_uuid)
|
80 | 80 |
|
|
90 | 90 |
self.key_mgr.get, self.ctxt, None)
|
91 | 91 |
|
92 | 92 |
def test_get_unknown_key(self):
|
93 | |
bad_key_uuid = str(uuid.uuid4())
|
|
93 |
bad_key_uuid = uuidutils.generate_uuid()
|
94 | 94 |
self.assertRaises(exception.ManagedObjectNotFoundError,
|
95 | 95 |
self.key_mgr.get, self.ctxt, bad_key_uuid)
|
96 | 96 |
|
28 | 28 |
import binascii
|
29 | 29 |
import copy
|
30 | 30 |
import random
|
31 | |
import uuid
|
32 | 31 |
|
33 | 32 |
from cryptography.hazmat import backends
|
34 | 33 |
from cryptography.hazmat.primitives.asymmetric import rsa
|
35 | 34 |
from cryptography.hazmat.primitives import serialization
|
|
35 |
from oslo_utils import uuidutils
|
36 | 36 |
|
37 | 37 |
from castellan.common import exception
|
38 | 38 |
from castellan.common.objects import private_key as pri_key
|
|
150 | 150 |
return private_key_uuid, public_key_uuid
|
151 | 151 |
|
152 | 152 |
def _generate_key_id(self):
|
153 | |
key_id = str(uuid.uuid4())
|
|
153 |
key_id = uuidutils.generate_uuid()
|
154 | 154 |
while key_id in self.keys:
|
155 | |
key_id = str(uuid.uuid4())
|
|
155 |
key_id = uuidutils.generate_uuid()
|
156 | 156 |
|
157 | 157 |
return key_id
|
158 | 158 |
|