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

This commit is contained in:
Zuul 2018-03-06 05:17:33 +00:00 committed by Gerrit Code Review
commit bfab9c508d
2 changed files with 4 additions and 5 deletions

View File

@ -11,10 +11,10 @@
# 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
import mock
from oslo_utils import uuidutils
from qinling.tests.unit.api import base
TEST_CASE_NAME = 'TestFunctionWorkerController'
@ -23,7 +23,7 @@ TEST_CASE_NAME = 'TestFunctionWorkerController'
class TestFunctionWorkerController(base.APITest):
@mock.patch('qinling.utils.etcd_util.get_workers')
def test_get_all_workers(self, mock_get_workers):
function_id = str(uuid.uuid4())
function_id = uuidutils.generate_uuid()
mock_get_workers.return_value = ['test_worker0', 'test_worker1']
resp = self.app.get('/v1/functions/%s/workers' % function_id)

View File

@ -12,10 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import uuid
import etcd3gw
from oslo_config import cfg
from oslo_utils import uuidutils
CONF = cfg.CONF
CLIENT = None
@ -39,7 +38,7 @@ def get_worker_lock():
def create_worker(function_id, worker):
client = get_client()
client.create(
'%s/worker_%s' % (function_id, str(uuid.uuid4())),
'%s/worker_%s' % (function_id, uuidutils.generate_uuid()),
worker
)