blob: 1b5713737e9bce0a0b4e0e1b6789474208efc8e8 [file] [log] [blame]
Steve Baker60bd2e02016-07-27 22:57:31 +00001#
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
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
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
12# under the License.
13
14"""A test module to exercise the Heat API with gabbi. """
15
16import os
17
18from gabbi import driver
19from six.moves.urllib import parse as urlparse
20
21from heat_integrationtests.common import clients
22from heat_integrationtests.common import config
23from heat_integrationtests.common import test
24
25TESTS_DIR = 'gabbits'
26
27
28def load_tests(loader, tests, pattern):
29 """Provide a TestSuite to the discovery process."""
30 test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
31
32 conf = config.CONF.heat_plugin
33 manager = clients.ClientManager(conf)
34 endpoint = manager.identity_client.get_endpoint_url(
35 'orchestration', conf.region)
36 host = urlparse.urlparse(endpoint).hostname
37 os.environ['OS_TOKEN'] = manager.identity_client.auth_token
38 os.environ['PREFIX'] = test.rand_name('api')
39
40 return driver.build_tests(test_dir, loader, host=host,
41 url=endpoint, test_loader_name=__name__)