def test_plugin_stylesheets(): plugin = plugins.lookup_plugin("plugin1", pluginpath) assert plugin.stylesheets == ["resources/foo.css"] plugin = plugins.lookup_plugin("plugin2", pluginpath) assert plugin.stylesheets == [] plugin = plugins.lookup_plugin("SingleFilePlugin1", pluginpath) assert plugin.stylesheets == []
def test_lookup_plugin(): plugin = plugins.lookup_plugin("DOES NOT EXIST", pluginpath) assert plugin is None plugin = plugins.lookup_plugin("plugin1", pluginpath) assert not plugin.errors assert plugin.location_name == "testplugins" plugin = plugins.lookup_plugin("SingleFilePlugin1", pluginpath) assert not plugin.errors
def test_templates_in_plugin(): plugin = plugins.lookup_plugin("plugin1", pluginpath) templates = plugin.templates assert len(templates) == 1 assert 'one.htmlt' in templates assert 'js micro template' in templates['one.htmlt'] tm = plugin.template_module assert "js micro template" in tm
def test_single_plugin_in_path(): temppath = pluginpath[:] temppath.append(dict(name="user", plugin=thisdir / "SinglePlugin.js", chop=len(thisdir))) plugin = plugins.lookup_plugin("SinglePlugin", temppath) errors = plugin.errors assert not errors plugin_list = plugins.find_plugins(temppath) assert len(plugin_list) == 7 p = plugin_list[6] assert p.name == "SinglePlugin" plugin_type = p.metadata['type'] assert plugin_type == "user" assert p.templates == {}
def test_single_plugin_in_path(): temppath = pluginpath[:] temppath.append( dict(name="user", plugin=thisdir / "SinglePlugin.js", chop=len(thisdir))) plugin = plugins.lookup_plugin("SinglePlugin", temppath) errors = plugin.errors assert not errors plugin_list = plugins.find_plugins(temppath) assert len(plugin_list) == 7 p = plugin_list[6] assert p.name == "SinglePlugin" plugin_type = p.metadata['type'] assert plugin_type == "user" assert p.templates == {}
def test_nonexistent_plugin(): temppath = pluginpath[:] temppath.append( dict(name="user", plugin=thisdir / "NotThere.js", chop=len(thisdir))) plugin = plugins.lookup_plugin("NotThere", temppath) assert plugin is None
def test_resource_url(): plugin = plugins.lookup_plugin("plugin1", pluginpath) md = plugin.metadata assert md["resourceURL"] == "resources/plugin1/"
def test_nonexistent_plugin(): temppath = pluginpath[:] temppath.append(dict(name="user", plugin=thisdir / "NotThere.js", chop=len(thisdir))) plugin = plugins.lookup_plugin("NotThere", temppath) assert plugin is None