summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_utils.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/nova/tests/test_utils.py b/nova/tests/test_utils.py
index 53ab5637c..138d049aa 100644
--- a/nova/tests/test_utils.py
+++ b/nova/tests/test_utils.py
@@ -18,6 +18,7 @@ import __builtin__
import datetime
import functools
import hashlib
+import importlib
import os
import os.path
import StringIO
@@ -27,10 +28,13 @@ import mox
import nova
from nova import exception
+from nova.openstack.common import cfg
from nova.openstack.common import timeutils
from nova import test
from nova import utils
+CONF = cfg.CONF
+
class ByteConversionTest(test.TestCase):
def test_string_conversions(self):
@@ -528,6 +532,29 @@ class MonkeyPatchTestCase(test.TestCase):
in nova.tests.monkey_patch_example.CALLED_FUNCTION)
+class MonkeyPatchDefaultTestCase(test.TestCase):
+ """Unit test for default monkey_patch_modules value."""
+
+ def setUp(self):
+ super(MonkeyPatchDefaultTestCase, self).setUp()
+ self.flags(
+ monkey_patch=True)
+
+ def test_monkey_patch_default_mod(self):
+ # monkey_patch_modules is defined to be
+ # <module_to_patch>:<decorator_to_patch_with>
+ # Here we check that both parts of the default values are
+ # valid
+ for module in CONF.monkey_patch_modules:
+ m = module.split(':', 1)
+ # Check we can import the module to be patched
+ importlib.import_module(m[0])
+ # check the decorator is valid
+ decorator_name = m[1].rsplit('.', 1)
+ decorator_module = importlib.import_module(decorator_name[0])
+ getattr(decorator_module, decorator_name[1])
+
+
class AuditPeriodTest(test.TestCase):
def setUp(self):