Ejemplo n.º 1
0
def test_tp_tool_bad(tp0, templates, english):
    other_project = ProjectDBFactory(source_language=english)
    other_tp = TranslationProjectFactory(
        project=other_project,
        language=LanguageDBFactory())
    tp_tool = TPTool(tp0.project)

    with pytest.raises(ValueError):
        tp_tool.check_tp(other_tp)

    with pytest.raises(ValueError):
        tp_tool.set_parents(tp0.directory, other_tp.directory)

    with pytest.raises(ValueError):
        tp_tool.set_parents(other_tp.directory, tp0.directory)

    with pytest.raises(ValueError):
        tp_tool.move(other_tp, templates)

    with pytest.raises(ValueError):
        tp_tool.clone(other_tp, templates)

    with pytest.raises(ValueError):
        # cant set tp to a language if a tp already exists
        tp_tool.move(
            tp0, Language.objects.get(code="language1"))

    with pytest.raises(ValueError):
        # cant clone tp to a language if a tp already exists
        tp_tool.clone(
            tp0, Language.objects.get(code="language1"))
Ejemplo n.º 2
0
def test_tp_tool_bad(po_directory, tp0, templates, english, no_templates_tps):
    other_project = ProjectDBFactory(source_language=english)
    other_tp = TranslationProjectFactory(
        project=other_project,
        language=LanguageDBFactory())
    tp_tool = TPTool(tp0.project)

    with pytest.raises(ValueError):
        tp_tool.check_tp(other_tp)

    with pytest.raises(ValueError):
        tp_tool.set_parents(tp0.directory, other_tp.directory)

    with pytest.raises(ValueError):
        tp_tool.set_parents(other_tp.directory, tp0.directory)

    with pytest.raises(ValueError):
        tp_tool.move(other_tp, templates)

    with pytest.raises(ValueError):
        tp_tool.clone(other_tp, templates)

    with pytest.raises(ValueError):
        # cant set tp to a language if a tp already exists
        tp_tool.move(
            tp0, Language.objects.get(code="language1"))

    with pytest.raises(ValueError):
        # cant clone tp to a language if a tp already exists
        tp_tool.clone(
            tp0, Language.objects.get(code="language1"))
Ejemplo n.º 3
0
def test_tp_tool_clone_project_same_lang(tp0, english):
    new_proj = ProjectDBFactory(source_language=english)
    tp_tool = TPTool(tp0.project)
    _test_tp_match(
        tp0,
        tp_tool.clone(tp0, tp0.language, new_proj),
        new_proj)
Ejemplo n.º 4
0
def test_tp_tool_clone_project(tp0, project1, member):
    new_lang = LanguageDBFactory()
    tp_tool = TPTool(tp0.project)
    _test_tp_match(
        tp0,
        tp_tool.clone(tp0, new_lang, project1),
        project1)
Ejemplo n.º 5
0
def test_tp_tool_clone_project_same_lang(tp0, english):
    new_proj = ProjectDBFactory(source_language=english)
    tp_tool = TPTool(tp0.project)
    _test_tp_match(
        tp0,
        tp_tool.clone(tp0, tp0.language, new_proj),
        new_proj)
Ejemplo n.º 6
0
def test_tp_tool_clone_project(tp0, project1):
    new_lang = LanguageDBFactory()
    tp_tool = TPTool(tp0.project)
    _test_tp_match(
        tp0,
        tp_tool.clone(tp0, new_lang, project1),
        project1)
Ejemplo n.º 7
0
def test_tp_tool_clone(po_directory, tp0, templates):
    new_lang = LanguageDBFactory()
    tp_tool = TPTool(tp0.project)
    _test_tp_match(tp0, tp_tool.clone(tp0, new_lang))
Ejemplo n.º 8
0
def test_tp_tool_clone_project(tp0, project1, member):
    new_lang = LanguageDBFactory()
    tp_tool = TPTool(tp0.project)
    Unit.objects.filter(store__translation_project=tp0).update(
        created_by=member)
    _test_tp_match(tp0, tp_tool.clone(tp0, new_lang, project1), project1)
Ejemplo n.º 9
0
def test_tp_tool_clone(tp0, templates):
    new_lang = LanguageDBFactory()
    tp_tool = TPTool(tp0.project)
    _test_tp_match(tp0, tp_tool.clone(tp0, new_lang))