def test_add_project_fs_no_plugins(tutorial): from pootle_fs.models import ProjectFS _clear_plugins() with pytest.raises(ValidationError): ProjectFS.objects.create( project=tutorial, fs_type="example")
def test_register_plugin(): _clear_plugins() class ExamplePlugin(Plugin): name = "example" plugins.register(ExamplePlugin) assert "example" in plugins assert plugins["example"] == ExamplePlugin
def test_save_project_fs_type_gone(tutorial_fs): """If the plugin that was registered is no longer available you cannot save the project_fs unless you switch to valid plugin """ _clear_plugins() _register_plugin(name="other") with pytest.raises(MissingPluginError): tutorial_fs.plugin.status() with pytest.raises(ValidationError): tutorial_fs.save() tutorial_fs.fs_type = "other" tutorial_fs.save()
def test_add_project_fs_no_plugins(tutorial): from pootle_fs.models import ProjectFS _clear_plugins() with pytest.raises(ValidationError): ProjectFS.objects.create(project=tutorial, fs_type="example")