Merge "Replace neutron create security group full with shade."
[yardstick.git] / yardstick / tests / functional / base.py
1 # Copyright (c) 2018 Intel Corporation
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import abc
16 import six
17
18 from oslo_config import cfg
19 from oslotest import base
20
21
22 CONF = cfg.CONF
23
24
25 @six.add_metaclass(abc.ABCMeta)
26 class BaseFunctionalTestCase(base.BaseTestCase):
27     """Base class for functional tests."""
28
29     def setUp(self):
30         super(BaseFunctionalTestCase, self).setUp()
31
32     def config(self, **kw):
33         """Override some configuration values.
34
35         The keyword arguments are the names of configuration options to
36         override and their values.
37
38         If a group argument is supplied, the overrides are applied to
39         the specified configuration option group.
40
41         All overrides are automatically cleared at the end of the current
42         test by the fixtures cleanup process.
43         """
44         group = kw.pop('group', None)
45         for k, v in kw.items():
46             CONF.set_override(k, v, group)