def setup_Plugins(): fake_page_msg = FakePageMsg() # install all internal plugin auto_install_plugins(debug=False, page_msg = fake_page_msg, verbosity=0) # install PyRM plugin install_plugin( package_name = "PyLucid.plugins_external", plugin_name = "PyRM_plugin", page_msg = fake_page_msg, verbosity = 2, user = a_user, active = True )
def test_reinit(self): """ reinit the plugin and check if the plugin model tabels would be droped and re-created. """ url = self.command % "plugin_models" plugin = self._get_plugin() package_name = plugin.package_name plugin_name = plugin.plugin_name page_msg = FakePageMsg() # remove the plugin completely from the database # plugin model tables should be droped plugin.delete(page_msg, verbosity=2) # install the plugin # plugin model tables should be re-created, too. install_plugin( package_name, plugin_name, page_msg, verbosity=2, user=None, active=True ) # Check 1: content = self._get_plugin_content(url)#, debug=True) self.assertEqual2( content, MODEL_TEST % {"no": 1} ) # Check 2: url = self.command % "all_models" content = self._get_plugin_content(url)#, debug=True) self.assertEqual2( content, ( "All Albums:\n" "1: TestAlbum 'A test Album', ID 1, createby: superuser" ) )
def _install_plugin(self, plugin_name, package_name, active=False): """ Put the plugin data and the internal pages from it into the database. """ self.page_msg(_("Install plugin '%s':") % plugin_name) if self.request.debug: verbosity = 2 else: verbosity = 1 try: install_plugin( package_name, plugin_name, self.page_msg, verbosity, self.request.user, active ) except Exception, e: if self.request.debug: raise raise ActionError(_("Error installing Plugin:"), e)