Kiran_totad 1c982ed19f Replaces uuid.uuid4 with uuidutils.generate_uuid()
Openstack oslo_utils has a generate_uuid function for generating
uuids. We should use that function when generating uuids for
consistency.

Change-Id: Ifa1c63d7c1aa7859458c42cbe6e56245c393c749
2017-07-24 06:54:42 +00:00

46 lines
1.6 KiB
Python

# Copyright (c) 2017 Catalyst IT Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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 mock
import distilclient
from distilclient import base
from distilclient.tests.unit import utils
from distilclient.v2 import client
from oslo_utils import uuidutils
class QuotationsTest(utils.TestCase):
def setUp(self):
super(QuotationsTest, self).setUp()
self.client = client.Client(session=client.session.Session(),
api_version=distilclient.API_MAX_VERSION,
distil_url=uuidutils.generate_uuid(),
retries=3,
input_auth_token='token')
@mock.patch.object(base.Manager, '_list')
def test_list_with_project_id(self, mock_list):
self.client.quotations.list('project_id')
mock_list.assert_called_with('/v2/quotations?project_id=project_id',
'quotations')
@mock.patch.object(base.Manager, '_list')
def test_list_without_project_id(self, mock_list):
self.client.quotations.list()
mock_list.assert_called_with('/v2/quotations', 'quotations')