Esempio n. 1
0
 def test_getNextJobStatus_wrong_packaging(self):
     """Jobs on wrong packaging should be ignored."""
     #suppress job creation.
     with EventRecorder():
         packaging = self.factory.makePackagingLink()
     self.factory.makePackagingLink(productseries=packaging.productseries)
     self.assertIs(None, TranslationMergeJob.getNextJobStatus(packaging))
     self.factory.makePackagingLink()
     self.factory.makePackagingLink(distroseries=packaging.distroseries)
     self.assertIs(None, TranslationMergeJob.getNextJobStatus(packaging))
     TranslationMergeJob.create(
         sourcepackagename=packaging.sourcepackagename,
         distroseries=packaging.distroseries,
         productseries=self.factory.makeProductSeries())
     self.assertIs(None, TranslationMergeJob.getNextJobStatus(packaging))
Esempio n. 2
0
def make_translation_merge_job(factory, not_ubuntu=False):
    singular = factory.getUniqueString()
    upstream_pofile = factory.makePOFile(side=TranslationSide.UPSTREAM)
    upstream_potmsgset = factory.makePOTMsgSet(upstream_pofile.potemplate,
                                               singular)
    upstream = factory.makeCurrentTranslationMessage(
        pofile=upstream_pofile, potmsgset=upstream_potmsgset)
    if not_ubuntu:
        distroseries = factory.makeDistroSeries()
    else:
        distroseries = factory.makeUbuntuDistroSeries()
    package_potemplate = factory.makePOTemplate(
        distroseries=distroseries, name=upstream_pofile.potemplate.name)
    package_pofile = factory.makePOFile(potemplate=package_potemplate,
                                        language=upstream_pofile.language)
    package_potmsgset = factory.makePOTMsgSet(package_pofile.potemplate,
                                              singular)
    factory.makeCurrentTranslationMessage(pofile=package_pofile,
                                          potmsgset=package_potmsgset,
                                          translations=upstream.translations)
    productseries = upstream_pofile.potemplate.productseries
    distroseries = package_pofile.potemplate.distroseries
    sourcepackagename = package_pofile.potemplate.sourcepackagename
    return TranslationMergeJob.create(productseries=productseries,
                                      distroseries=distroseries,
                                      sourcepackagename=sourcepackagename)
def make_translation_merge_job(factory, not_ubuntu=False):
    singular = factory.getUniqueString()
    upstream_pofile = factory.makePOFile(side=TranslationSide.UPSTREAM)
    upstream_potmsgset = factory.makePOTMsgSet(
        upstream_pofile.potemplate, singular)
    upstream = factory.makeCurrentTranslationMessage(
        pofile=upstream_pofile, potmsgset=upstream_potmsgset)
    if not_ubuntu:
        distroseries = factory.makeDistroSeries()
    else:
        distroseries = factory.makeUbuntuDistroSeries()
    package_potemplate = factory.makePOTemplate(
        distroseries=distroseries, name=upstream_pofile.potemplate.name)
    package_pofile = factory.makePOFile(
        potemplate=package_potemplate, language=upstream_pofile.language)
    package_potmsgset = factory.makePOTMsgSet(
        package_pofile.potemplate, singular)
    factory.makeCurrentTranslationMessage(
        pofile=package_pofile, potmsgset=package_potmsgset,
        translations=upstream.translations)
    productseries = upstream_pofile.potemplate.productseries
    distroseries = package_pofile.potemplate.distroseries
    sourcepackagename = package_pofile.potemplate.sourcepackagename
    return TranslationMergeJob.create(
        productseries=productseries, distroseries=distroseries,
        sourcepackagename=sourcepackagename)
 def test_getNextJobStatus_wrong_packaging(self):
     """Jobs on wrong packaging should be ignored."""
     #suppress job creation.
     with EventRecorder():
         packaging = self.factory.makePackagingLink()
     self.factory.makePackagingLink(
         productseries=packaging.productseries)
     self.assertIs(None, TranslationMergeJob.getNextJobStatus(packaging))
     self.factory.makePackagingLink()
     self.factory.makePackagingLink(
         distroseries=packaging.distroseries)
     self.assertIs(None, TranslationMergeJob.getNextJobStatus(packaging))
     TranslationMergeJob.create(
         sourcepackagename=packaging.sourcepackagename,
         distroseries=packaging.distroseries,
         productseries=self.factory.makeProductSeries())
     self.assertIs(None, TranslationMergeJob.getNextJobStatus(packaging))