def test_construct(self): """ Testing plugin instanciation """ pname_type = { 'dummy': Extension, 'dummy_datasource': DatasourcePlugin, #'webui': InterfacePlugin, #singleton, cannot reinstanciate #'ram_session': SessionHandlerPlugin, #singleton, cannot resintanciate } for pname, ptype in pname_type.items(): pinstance = Plugin.get(pname) self.assertIsInstance( pinstance, ptype, "Expected plugin '%s' \ to be in an %s instance but found an %s instance" % (pname, ptype, pinstance.__class__))
def test_get_returns_proper_plugin_instance(self): Plugin.register('dummy') self.assertTrue(Plugin.get('dummy').__class__, Plugin)
def test_construct_invalid(self): """ Testing plugin instanciation with a non existing name """ with self.assertRaises(PluginError): Plugin.get("fljkhsfh")