summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Scheuring <andreas.scheuring@de.ibm.com>2017-03-22 14:43:57 +0100
committerAndreas Scheuring <andreas.scheuring@de.ibm.com>2017-03-22 16:16:20 +0100
commitc2982df181f82fd321c64f2d81f96043627c640d (patch)
tree11528638408cd09f70e49a8dd332060272469844
parent6a41e154d42bc0b6ff85e50c0e76dd2a99c7cd88 (diff)
Introduce flags() method for overriding conf opts
Introducing the flags method in the networking_dpm base test case. It provides an easy way of overriding config options during unit tests. Change-Id: I1abd257ed888e3278fe0b431770ea1854d1e7305
Notes
Notes (review): Code-Review+2: Andreas Scheuring <andreas.scheuring@de.ibm.com> Workflow+1: Andreas Scheuring <andreas.scheuring@de.ibm.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Wed, 22 Mar 2017 16:25:45 +0000 Reviewed-on: https://review.openstack.org/448609 Project: openstack/networking-dpm Branch: refs/heads/master
-rw-r--r--networking_dpm/tests/base.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/networking_dpm/tests/base.py b/networking_dpm/tests/base.py
index cb7ac75..f59110a 100644
--- a/networking_dpm/tests/base.py
+++ b/networking_dpm/tests/base.py
@@ -15,9 +15,16 @@
15# License for the specific language governing permissions and limitations 15# License for the specific language governing permissions and limitations
16# under the License. 16# under the License.
17 17
18from oslo_config import cfg
19
18from neutron.tests import base 20from neutron.tests import base
19 21
20 22
21class BaseTestCase(base.BaseTestCase): 23class BaseTestCase(base.BaseTestCase):
22 24
23 """Test case base class for all unit tests.""" 25 """Test case base class for all unit tests."""
26 def flags(self, **kw):
27 """Override config variables for a test."""
28 group = kw.pop('group', None)
29 for k, v in kw.items():
30 cfg.CONF.set_override(k, v, group, enforce_type=True)