Replace uuid4() with generate_uuid() from oslo_utils

UUID can be generated using uuid4() as well as
uuidutils.generate_utils(). Since we are using the latter in the
Mistral code, we shall maintain the same on the client as well.

Change-Id: I65c27bb6253cecc80bd538ba6d59022141d22b6c
Closes-Bug: #1082248
This commit is contained in:
Sharat Sharma
2016-11-18 14:21:55 +05:30
parent 741e6b1816
commit 84a5491167
2 changed files with 11 additions and 11 deletions

View File

@@ -16,9 +16,9 @@
import json import json
import os import os
import tempfile import tempfile
import uuid
import mock import mock
from oslo_utils import uuidutils
from oslotest import base from oslotest import base
import osprofiler.profiler import osprofiler.profiler
@@ -37,9 +37,9 @@ class BaseClientTests(base.BaseTestCase):
@staticmethod @staticmethod
def setup_keystone_mock(keystone_client_mock): def setup_keystone_mock(keystone_client_mock):
keystone_client_instance = keystone_client_mock.return_value keystone_client_instance = keystone_client_mock.return_value
keystone_client_instance.auth_token = str(uuid.uuid4()) keystone_client_instance.auth_token = uuidutils.generate_uuid()
keystone_client_instance.project_id = str(uuid.uuid4()) keystone_client_instance.project_id = uuidutils.generate_uuid()
keystone_client_instance.user_id = str(uuid.uuid4()) keystone_client_instance.user_id = uuidutils.generate_uuid()
keystone_client_instance.auth_ref = str(json.dumps({})) keystone_client_instance.auth_ref = str(json.dumps({}))
return keystone_client_instance return keystone_client_instance

View File

@@ -14,12 +14,12 @@
import base64 import base64
import copy import copy
import uuid
import mock import mock
from oslotest import base from oslotest import base
import requests import requests
from oslo_utils import uuidutils
from osprofiler import _utils as osprofiler_utils from osprofiler import _utils as osprofiler_utils
import osprofiler.profiler import osprofiler.profiler
@@ -30,11 +30,11 @@ API_URL = '/executions'
EXPECTED_URL = API_BASE_URL + API_URL EXPECTED_URL = API_BASE_URL + API_URL
AUTH_TOKEN = str(uuid.uuid4()) AUTH_TOKEN = uuidutils.generate_uuid()
PROJECT_ID = str(uuid.uuid4()) PROJECT_ID = uuidutils.generate_uuid()
USER_ID = str(uuid.uuid4()) USER_ID = uuidutils.generate_uuid()
PROFILER_HMAC_KEY = 'SECRET_HMAC_KEY' PROFILER_HMAC_KEY = 'SECRET_HMAC_KEY'
PROFILER_TRACE_ID = str(uuid.uuid4()) PROFILER_TRACE_ID = uuidutils.generate_uuid()
EXPECTED_AUTH_HEADERS = { EXPECTED_AUTH_HEADERS = {
'x-auth-token': AUTH_TOKEN, 'x-auth-token': AUTH_TOKEN,
@@ -134,8 +134,8 @@ class HTTPClientTest(base.BaseTestCase):
mock.MagicMock(return_value=FakeResponse('get', EXPECTED_URL, 200)) mock.MagicMock(return_value=FakeResponse('get', EXPECTED_URL, 200))
) )
def test_get_request_options_with_headers_for_get(self): def test_get_request_options_with_headers_for_get(self):
target_auth_url = str(uuid.uuid4()) target_auth_url = uuidutils.generate_uuid()
target_auth_token = str(uuid.uuid4()) target_auth_token = uuidutils.generate_uuid()
target_user_id = 'target_user' target_user_id = 'target_user'
target_project_id = 'target_project' target_project_id = 'target_project'
target_service_catalog = 'this should be there' target_service_catalog = 'this should be there'