def test_tp_tool_custom_getter(project0, no_tp_tool_): class CustomTPTool(TPTool): pass @getter(tp_tool, sender=Project, weak=False) def custom_tp_tool_getter(**kwargs_): return CustomTPTool assert tp_tool.get(Project) is CustomTPTool assert isinstance(project0.tp_tool, CustomTPTool)
def test_tp_tool_store_clone_with_checks(store_po, system): store_po.update( create_store(pootle_path=store_po.pootle_path, units=[("Hello", "", False)])) unit = store_po.units.first() unit.target = "Hello\n\nHello" unit.save() check_qs = unit.qualitycheck_set.filter(category=Category.CRITICAL, false_positive=False) assert check_qs.count() == 1 check_id = check_qs[0].id unit.toggle_qualitycheck(check_id=check_id, false_positive=True, user=system) assert unit.qualitycheck_set.get(id=check_id).false_positive tool = tp_tool.get(Project)(store_po.translation_project.project) directory = store_po.translation_project.directory.child_dirs.first() cloned_store = tool.clone_store(store_po, directory) cloned_unit = cloned_store.units[0] check_qs = cloned_unit.qualitycheck_set.filter(category=Category.CRITICAL) assert check_qs.count() == 1 assert check_qs[0].false_positive
def test_tp_tool_store_clone_with_checks(store_po, system): store_po.update(create_store(pootle_path=store_po.pootle_path, units=[ ("Hello", "", False) ])) unit = store_po.units.first() unit.target = "Hello\n\nHello" unit.save() check_qs = unit.qualitycheck_set.filter( category=Category.CRITICAL, false_positive=False) assert check_qs.count() == 1 check_id = check_qs[0].id unit.toggle_qualitycheck(check_id=check_id, false_positive=True, user=system) assert unit.qualitycheck_set.get(id=check_id).false_positive tool = tp_tool.get(Project)(store_po.translation_project.project) directory = store_po.translation_project.directory.child_dirs.first() cloned_store = tool.clone_store(store_po, directory) cloned_unit = cloned_store.units[0] check_qs = cloned_unit.qualitycheck_set.filter(category=Category.CRITICAL) assert check_qs.count() == 1 assert check_qs[0].false_positive
def test_tp_tool_getter(project0_directory, project0): assert tp_tool.get(Project) is TPTool assert isinstance(project0.tp_tool, TPTool)
def tp_tool(self): return tp_tool.get(self.__class__)(self)
def test_tp_tool_getter(project0): assert tp_tool.get(Project) is TPTool assert isinstance(project0.tp_tool, TPTool)