def test_load_loadable_bad_plugin(self, m_driver_manager): m_driver_manager.side_effect = Exception() loader_manager = default.DefaultLoader(namespace='TESTING') self.assertRaises(exception.LoadingError, loader_manager.load, name='bad_driver')
def test_load_loadable_no_opt(self): fake_driver = drivermanager.DriverManager.make_test_instance( extension=stevedore_extension.Extension( name="fake", entry_point="%s:%s" % (FakeLoadable.__module__, FakeLoadable.__name__), plugin=FakeLoadable, obj=None), namespace="TESTING") loader_manager = default.DefaultLoader(namespace='TESTING') with mock.patch.object(drivermanager, "DriverManager") as m_driver_manager: m_driver_manager.return_value = fake_driver loaded_driver = loader_manager.load(name='fake') self.assertIsInstance(loaded_driver, FakeLoadable)