Exemple #1
0
def test_add_project_fs_bad_fs_type(tutorial):
    from pootle_fs.models import ProjectFS
    _register_plugin()

    with pytest.raises(ValidationError):
        ProjectFS.objects.create(
            project=tutorial, fs_type="BAD")
Exemple #2
0
def test_add_project_fs(tutorial):
    from pootle_fs.models import ProjectFS
    _register_plugin()
    project_fs = ProjectFS.objects.create(
        project=tutorial, fs_type="example")
    project_fs.save()
    assert project_fs.pootle_config == ".pootle.ini"
Exemple #3
0
def test_add_project_fs_again(tutorial):
    from pootle_fs.models import ProjectFS
    _register_plugin()
    project_fs = ProjectFS.objects.create(project=tutorial, fs_type="example")
    project_fs.save()

    with pytest.raises(IntegrityError):
        project_fs = ProjectFS.objects.create(project=tutorial,
                                              fs_type="example")
        project_fs.save()
Exemple #4
0
def test_add_project_fs_again(tutorial):
    from pootle_fs.models import ProjectFS
    _register_plugin()
    project_fs = ProjectFS.objects.create(
        project=tutorial, fs_type="example")
    project_fs.save()

    with pytest.raises(IntegrityError):
        project_fs = ProjectFS.objects.create(
            project=tutorial, fs_type="example")
        project_fs.save()
Exemple #5
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()
Exemple #6
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()
Exemple #7
0
def test_save_project_fs_type(tutorial_fs):
    _register_plugin(name="other", clear=False)
    tutorial_fs.fs_type = "other"
    tutorial_fs.save()
    assert tutorial_fs.fs_type == "other"
Exemple #8
0
def test_add_project_fs_bad_fs_type(tutorial):
    from pootle_fs.models import ProjectFS
    _register_plugin()

    with pytest.raises(ValidationError):
        ProjectFS.objects.create(project=tutorial, fs_type="BAD")
Exemple #9
0
def test_add_project_fs_no_project(tutorial):
    from pootle_fs.models import ProjectFS
    _register_plugin()

    with pytest.raises(IntegrityError):
        ProjectFS.objects.create(fs_type="example")
Exemple #10
0
def test_add_project_fs(tutorial):
    from pootle_fs.models import ProjectFS
    _register_plugin()
    project_fs = ProjectFS.objects.create(project=tutorial, fs_type="example")
    project_fs.save()
    assert project_fs.pootle_config == ".pootle.ini"
Exemple #11
0
def test_save_project_fs_type(tutorial_fs):
    _register_plugin(name="other", clear=False)
    tutorial_fs.fs_type = "other"
    tutorial_fs.save()
    assert tutorial_fs.fs_type == "other"
Exemple #12
0
def test_add_project_fs_no_project(tutorial):
    from pootle_fs.models import ProjectFS
    _register_plugin()

    with pytest.raises(IntegrityError):
        ProjectFS.objects.create(fs_type="example")