Exemplo n.º 1
0
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")
Exemplo n.º 2
0
def test_register_plugin():
    _clear_plugins()

    class ExamplePlugin(Plugin):
        name = "example"

    plugins.register(ExamplePlugin)

    assert "example" in plugins
    assert plugins["example"] == ExamplePlugin
Exemplo n.º 3
0
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()
Exemplo n.º 4
0
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()
Exemplo n.º 5
0
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")