blob: b08766a7dbb1e4eb2af361ea2ec7727c4e300e86 [file] [log] [blame]
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +04001# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13from heat_integrationtests.common import test
14
15
16class ScenarioTestsBase(test.HeatIntegrationTest):
17 "This class define common parameters for scenario tests"
18
19 def setUp(self):
20 super(ScenarioTestsBase, self).setUp()
21 self.client = self.orchestration_client
22 self.sub_dir = 'templates'
23 self.assign_keypair()
24 self.net = self._get_default_network()
25
26 if not self.conf.image_ref:
27 raise self.skipException("No image configured to test")
28 if not self.conf.instance_type:
29 raise self.skipException("No flavor configured to test")
30
31 def launch_stack(self, template_name, expected_status='CREATE_COMPLETE',
32 parameters=None, **kwargs):
33 template = self._load_template(__file__, template_name, self.sub_dir)
34
35 parameters = parameters or {}
36
37 if kwargs.get('add_parameters'):
38 parameters.update(kwargs['add_parameters'])
39
40 stack_id = self.stack_create(
41 stack_name=kwargs.get('stack_name'),
42 template=template,
43 files=kwargs.get('files'),
44 parameters=parameters,
45 environment=kwargs.get('environment'),
46 expected_status=expected_status
47 )
48
49 return stack_id