Coverage: Full coverage for engine plugin manager

Added unit tests to get 100% coverage for engine plugin manager

Change-Id: I8f8fec9959bd76dc4f768979d2c807c368ce7633
This commit is contained in:
ubuntu 2015-06-18 06:44:57 +05:30
parent 62d5cbcf33
commit 0815cf337b
1 changed files with 26 additions and 0 deletions

View File

@ -40,6 +40,18 @@ def error_test_mapping():
raise MappingTestError
def error_test_exception_mapping():
raise Exception("exception")
def invalid_type_test_mapping():
return 'foo'
def none_return_test_mapping():
return
class MappingTestError(Exception):
pass
@ -82,6 +94,20 @@ class TestPluginManager(common.HeatTestCase):
pm = plugin_manager.PluginMapping('error_test')
self.assertRaises(MappingTestError, pm.load_from_module, self.module())
def test_load_mapping_exception(self):
pm = plugin_manager.PluginMapping('error_test_exception')
self.assertRaisesRegex(Exception,
"exception",
pm.load_from_module, self.module())
def test_load_mapping_invalidtype(self):
pm = plugin_manager.PluginMapping('invalid_type_test')
self.assertEqual({}, pm.load_from_module(self.module()))
def test_load_mapping_nonereturn(self):
pm = plugin_manager.PluginMapping('none_return_test')
self.assertEqual({}, pm.load_from_module(self.module()))
def test_modules(self):
mgr = plugin_manager.PluginManager('heat.tests')