Example #1
0
    def test_set_plugin_state(self, mock_update_cherrypy, mock_config_file):
        mock_update_cherrypy.return_value = True

        with RollbackContext() as rollback:

            config_file_name = self._create_fake_config_file()
            rollback.prependDefer(os.remove, config_file_name)

            mock_config_file.return_value = config_file_name

            set_plugin_state('pluginA', False)
            with open(config_file_name, 'r') as f:
                updated_conf = f.read()
                self.assertEqual(
                    updated_conf,
                    self._get_config_file_template(enable=False)
                )

            set_plugin_state('pluginA', True)
            with open(config_file_name, 'r') as f:
                updated_conf = f.read()
                self.assertEqual(
                    updated_conf,
                    self._get_config_file_template(enable=True)
                )
Example #2
0
 def disable(self, name):
     set_plugin_state(name, False)
Example #3
0
 def enable(self, name):
     set_plugin_state(name, True)
Example #4
0
 def disable(self, name):
     name = name.encode('utf-8')
     set_plugin_state(name, False)
Example #5
0
 def enable(self, name):
     name = name.encode('utf-8')
     set_plugin_state(name, True)
Example #6
0
 def disable(self, name):
     name = name.encode('utf-8')
     set_plugin_state(name, False)
Example #7
0
 def enable(self, name):
     name = name.encode('utf-8')
     set_plugin_state(name, True)