def test_list_missing_settings_on_plugin(self): """ If the installed plugin is missing settings. """ self._add_plugin(create_plugin(self.plugindir, template="python", bundle="test01", name="plugin01")) plugin_config_filename = join(self.plugindir, "plugin01", "config.cfg") with open(plugin_config_filename, "r") as fh: config = SafeConfigParser() config.readfp(fh) # What if this plugin has no settings whatsoever, perhaps the plugin # author just didn't have any and did not include that section config.remove_section("settings") with open(plugin_config_filename, "w") as fh: config.write(fh) self.run_command("list -r {0}".format(self.gitrepodir)) self.assertResults( result_with_hint( u""" Installed plugins have no settings. """, CHANGE_PLUGIN_SETTINGS, ), self.output, )
def test_list_missing_settings_on_plugin(self): """ If the installed plugin is missing settings. """ self._add_plugin( create_plugin(self.plugindir, template='python', bundle='test01', name='plugin01')) plugin_config_filename = join(self.plugindir, 'plugin01', 'config.cfg') with open(plugin_config_filename, 'r') as fh: config = SafeConfigParser() config.readfp(fh) # What if this plugin has no settings whatsoever, perhaps the plugin # author just didn't have any and did not include that section config.remove_section('settings') with open(plugin_config_filename, 'w') as fh: config.write(fh) self.run_command('list -r {0}'.format(self.gitrepodir)) self.assertResults( result_with_hint( u''' Installed plugins have no settings. ''', CHANGE_PLUGIN_SETTINGS), self.output)
def _plugin_about(self, plugin_dir, settings_about): """ Create about/help messages for specific plugin settings. """ config_filename = join(plugin_dir, "config.cfg") config = SafeConfigParser() with open(config_filename) as fh: config.readfp(fh) for key, value in settings_about.items(): config.set("help", key, value) with open(config_filename, "w") as fh: config.write(fh)
def _plugin_about(self, plugin_dir, settings_about): """ Create about/help messages for specific plugin settings. """ config_filename = join(plugin_dir, 'config.cfg') config = SafeConfigParser() with open(config_filename) as fh: config.readfp(fh) for key, value in settings_about.items(): config.set('help', key, value) with open(config_filename, 'w') as fh: config.write(fh)