示例#1
0
def test_real_plugin_disable(conf):
    installed_apps_before = conf.config["INSTALLED_APPS"][:]
    test_plugin = "kolibri.plugins.media_player"
    assert test_plugin in installed_apps_before
    # Because RIP example plugin
    cli.plugin(test_plugin, disable=True)
    assert test_plugin not in conf.config["INSTALLED_APPS"]
示例#2
0
def test_real_plugin_disable(conf):
    installed_apps_before = conf.config["INSTALLED_APPS"][:]
    test_plugin = "kolibri.plugins.media_player"
    assert test_plugin in installed_apps_before
    # Because RIP example plugin
    cli.plugin(test_plugin, disable=True)
    assert test_plugin not in conf.config["INSTALLED_APPS"]
示例#3
0
def test_plugin_with_no_plugin_class(conf):
    """
    Expected behavior is that nothing blows up with exceptions, user just gets
    a warning and nothing is enabled or changed in the configuration.
    """
    # For fun, we pass in a system library
    installed_apps_before = conf.config["INSTALLED_APPS"][:]
    cli.plugin("os.path")
    assert installed_apps_before == conf.config["INSTALLED_APPS"]
示例#4
0
def test_plugin_cannot_be_imported_disable(conf):
    """
    A plugin may be in conf.config['INSTALLED_APPS'] but broken or uninstalled
    """
    plugin_name = "giraffe.horse"
    conf.config["INSTALLED_APPS"].append(plugin_name)
    conf.save()
    cli.plugin(plugin_name, disable=True)
    assert plugin_name not in conf.config["INSTALLED_APPS"]
示例#5
0
def test_plugin_with_no_plugin_class(conf):
    """
    Expected behavior is that nothing blows up with exceptions, user just gets
    a warning and nothing is enabled or changed in the configuration.
    """
    # For fun, we pass in a system library
    installed_apps_before = conf.config["INSTALLED_APPS"][:]
    cli.plugin("os.path")
    assert installed_apps_before == conf.config["INSTALLED_APPS"]
示例#6
0
def test_plugin_cannot_be_imported_disable(conf):
    """
    A plugin may be in conf.config['INSTALLED_APPS'] but broken or uninstalled
    """
    plugin_name = "giraffe.horse"
    conf.config["INSTALLED_APPS"].append(plugin_name)
    conf.save()
    cli.plugin(plugin_name, disable=True)
    assert plugin_name not in conf.config["INSTALLED_APPS"]
示例#7
0
def test_plugin_cannot_be_imported_disable(conf):
    """
    A plugin may be in conf.config['INSTALLED_APPS'] but broken or uninstalled
    """
    plugin_name = "giraffe.horse"
    conf.config["INSTALLED_APPS"].add(plugin_name)
    conf.config.save()
    cli.plugin(plugin_name, disable=True)
    assert plugin_name not in conf.config["INSTALLED_APPS"]
    # We also don't want to endlessly add cruft to the disabled apps
    assert plugin_name not in conf.config["DISABLED_APPS"]
示例#8
0
def test_real_plugin_disable_twice(conf):
    installed_apps_before = conf.config["INSTALLED_APPS"].copy()
    test_plugin = "kolibri.plugins.media_player"
    assert test_plugin in installed_apps_before
    cli.plugin(test_plugin, disable=True)
    assert test_plugin not in conf.config.ACTIVE_PLUGINS
    assert test_plugin not in conf.config["INSTALLED_APPS"]
    assert test_plugin in conf.config["DISABLED_APPS"]
    installed_apps_before = conf.config["INSTALLED_APPS"].copy()
    cli.plugin(test_plugin, disable=True)
    assert test_plugin not in conf.config.ACTIVE_PLUGINS
    assert test_plugin not in conf.config["INSTALLED_APPS"]
    assert test_plugin in conf.config["DISABLED_APPS"]
示例#9
0
def test_bogus_plugin_disable(conf):
    installed_apps_before = conf.config["INSTALLED_APPS"][:]
    cli.plugin("i_do_not_exist", disable=True)
    assert installed_apps_before == conf.config["INSTALLED_APPS"]
示例#10
0
def test_bogus_plugin_disable(conf):
    installed_apps_before = conf.config["INSTALLED_APPS"][:]
    cli.plugin("i_do_not_exist", disable=True)
    assert installed_apps_before == conf.config["INSTALLED_APPS"]