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