2
# Licensed under the Apache License, Version 2.0 (the "License"); you may
3
# not use this file except in compliance with the License. You may obtain
4
# a copy of the License at
6
# http://www.apache.org/licenses/LICENSE-2.0
8
# Unless required by applicable law or agreed to in writing, software
9
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11
# License for the specific language governing permissions and limitations
17
from heatclient.v1.resource_types import ResourceTypeManager
20
class ResourceTypeManagerTest(testtools.TestCase):
22
def test_list_types(self):
23
manager = ResourceTypeManager(None)
24
manager._list = mock.MagicMock()
26
manager._list.assert_called_once_with('/resource_types',
30
resource_type = u'OS::Nova::KeyPair'
32
class FakeAPI(object):
33
"""Fake API and ensure request url is correct."""
34
def __init__(self, *args, **kwargs):
37
def json_request(self, *args, **kwargs):
38
self.requests.append(args)
39
return {}, {'attributes': [], 'properties': []}
42
manager = ResourceTypeManager(test_api)
43
manager.get(resource_type)
44
expect = ('GET', '/resource_types/OS%3A%3ANova%3A%3AKeyPair')
45
self.assertIn(expect, test_api.requests)