Example #1
0
File: env.py Project: sshyran/zing
    def setup_terminology(self):
        from tests.factories import (
            ProjectDBFactory,
            StoreDBFactory,
            TranslationProjectFactory,
            UnitDBFactory,
        )
        from pootle_language.models import Language

        source_language = Language.objects.get(code="en")
        terminology = ProjectDBFactory(
            code="terminology",
            checkstyle="terminology",
            fullname="Terminology",
            source_language=source_language,
        )
        for language in Language.objects.exclude(code="en"):
            tp = TranslationProjectFactory(project=terminology,
                                           language=language)

            store = StoreDBFactory(translation_project=tp,
                                   name="terminology.po")
            store.save()
            for i_ in range(0, 1):
                UnitDBFactory(store=store)
Example #2
0
File: env.py Project: sshyran/zing
    def _add_stores(self, tp, n=(3, 2), parent=None):
        from tests.factories import StoreDBFactory, UnitDBFactory

        from pootle_store.constants import UNTRANSLATED, TRANSLATED, FUZZY, OBSOLETE

        for i_ in range(0, n[0]):
            # add 3 stores
            if parent is None:
                store = StoreDBFactory(translation_project=tp)
            else:
                store = StoreDBFactory(translation_project=tp, parent=parent)
            store.save()

            # add 8 units to each store
            for state in [UNTRANSLATED, TRANSLATED, FUZZY, OBSOLETE]:
                for i_ in range(0, n[1]):
                    UnitDBFactory(store=store, state=state)