コード例 #1
0
def test_tp_tool_update(po_directory, tp0, templates):
    new_lang = LanguageDBFactory()
    tp0_tool = TPTool(tp0.project)
    new_tp = tp0.project.translationproject_set.create(
        language=new_lang)

    # this will clone stores/directories as new_tp is empty
    tp0_tool.update_from_tp(tp0, new_tp)
    _test_tp_match(tp0, new_tp, update=True)
    tp0_tool.update_from_tp(tp0, new_tp)

    tp0.stores.first().delete()
    tp0.stores.first().units.first().delete()
    unit = tp0.stores.first().units.first()
    unit.source = multistring(["NEW TARGET", "NEW TARGETS"])
    unit.target = "NEW TARGET"
    unit.context = "something-else"
    unit.save()
    newunit = unit.__class__()
    newunit.source = multistring(["OTHER NEW TARGET", "OTHER NEW TARGETS"])
    newunit.target = "OTHER NEW TARGET"
    newunit.context = "something-else-again"
    unit.store.addunit(newunit)

    tp0_tool.update_from_tp(tp0, new_tp)
    _test_tp_match(tp0, new_tp, update=True)

    # doing another update does nothing
    tp0_tool.update_from_tp(tp0, new_tp)
    _test_tp_match(tp0, new_tp, update=True)
コード例 #2
0
ファイル: translationproject.py プロジェクト: ainslied/pootle
def test_tp_tool_update(po_directory, tp0, templates):
    new_lang = LanguageDBFactory()
    tp0_tool = TPTool(tp0.project)
    new_tp = tp0.project.translationproject_set.create(
        language=new_lang)

    # this will clone stores/directories as new_tp is empty
    tp0_tool.update_from_tp(tp0, new_tp)
    _test_tp_match(tp0, new_tp)
    tp0_tool.update_from_tp(tp0, new_tp)

    tp0.stores.first().delete()
    tp0.stores.first().units.first().delete()
    unit = tp0.stores.first().units.first()
    unit.source = multistring(["NEW TARGET", "NEW TARGETS"])
    unit.target = "NEW TARGET"
    unit.context = "something-else"
    unit.save()
    newunit = unit.__class__()
    newunit.source = multistring(["OTHER NEW TARGET", "OTHER NEW TARGETS"])
    newunit.target = "OTHER NEW TARGET"
    newunit.context = "something-else-again"
    unit.store.addunit(newunit)

    tp0_tool.update_from_tp(tp0, new_tp)
    _test_tp_match(tp0, new_tp)

    # doing another update does nothing
    tp0_tool.update_from_tp(tp0, new_tp)
    _test_tp_match(tp0, new_tp)
コード例 #3
0
def test_tp_tool_update(po_directory, tp0, templates):
    new_lang = LanguageDBFactory()
    tp0_tool = TPTool(tp0.project)
    new_tp = tp0.project.translationproject_set.create(language=new_lang)

    # this will clone stores/directories as new_tp is empty
    tp0_tool.update_from_tp(tp0, new_tp)
    _test_tp_match(tp0, new_tp)
    tp0_tool.update_from_tp(tp0, new_tp)

    tp0.stores.first().delete()
    tp0.stores.first().units.first().delete()
    unit = tp0.stores.first().units.first()
    unit.target = "NEW TARGET"
    unit.save()
    tp0_tool.update_from_tp(tp0, new_tp)
    _test_tp_match(tp0, new_tp)

    # doing another update does nothing
    tp0_tool.update_from_tp(tp0, new_tp)
    _test_tp_match(tp0, new_tp)
コード例 #4
0
ファイル: translationproject.py プロジェクト: Finntack/pootle
def test_tp_tool_update(tp0, templates):
    new_lang = LanguageDBFactory()
    tp0_tool = TPTool(tp0.project)
    new_tp = tp0.project.translationproject_set.create(
        language=new_lang)

    # this will clone stores/directories as new_tp is empty
    tp0_tool.update_from_tp(tp0, new_tp)
    _test_tp_match(tp0, new_tp)
    tp0_tool.update_from_tp(tp0, new_tp)

    tp0.stores.first().delete()
    tp0.stores.first().units.first().delete()
    unit = tp0.stores.first().units.first()
    unit.target = "NEW TARGET"
    unit.save()
    tp0_tool.update_from_tp(tp0, new_tp)
    _test_tp_match(tp0, new_tp)

    # doing another update does nothing
    tp0_tool.update_from_tp(tp0, new_tp)
    _test_tp_match(tp0, new_tp)