Esempio n. 1
0
    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__))
Esempio n. 2
0
 def test_get_returns_proper_plugin_instance(self):
     Plugin.register('dummy')
     self.assertTrue(Plugin.get('dummy').__class__, Plugin)
Esempio n. 3
0
 def test_construct_invalid(self):
     """ Testing plugin instanciation with a non existing name """
     with self.assertRaises(PluginError):
         Plugin.get("fljkhsfh")