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")
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"
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()
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()
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_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"
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")
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")
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"