Beispiel #1
0
    def test_merge_translations(self):
        job = make_translation_merge_job(self.factory)
        transaction.commit()
        retcode, stdout, stderr = run_script(
            'cronscripts/process-job-source.py',
            ['ITranslationPackagingJobSource'],
            expect_returncode=0)
        matcher = MatchesRegex(
            dedent("""\
            INFO    Creating lockfile: /var/lock/launchpad-process-job-source-ITranslationPackagingJobSource.lock
            INFO    Running synchronously.
            INFO    Running <.*?TranslationMergeJob.*?> \(ID .*\) in status Waiting
            INFO    Merging .* and .* in Ubuntu Distroseries.*
            INFO    Deleted POTMsgSets: 1.  TranslationMessages: 1.
            INFO    Merging template 1/2.
            INFO    Merging template 2/2.
            INFO    Ran 1 TranslationMergeJob jobs.
            """))
        self.assertThat(stderr, matcher)
        self.assertEqual('', stdout)

        with admin_logged_in():
            job.distroseries.getSourcePackage(
                job.sourcepackagename).deletePackaging()
        transaction.commit()
        retcode, stdout, stderr = run_script(
            'cronscripts/process-job-source.py',
            ['ITranslationPackagingJobSource'],
            expect_returncode=0)
        matcher = MatchesRegex(
            dedent("""\
            INFO    Creating lockfile: /var/lock/launchpad-process-job-source-ITranslationPackagingJobSource.lock
            INFO    Running synchronously.
            INFO    Running <.*?TranslationSplitJob.*?> \(ID .*\) in status Waiting
            INFO    Splitting .* and .* in Ubuntu Distroseries.*
            INFO    1 entries split.
            INFO    Ran 1 TranslationSplitJob jobs.
            """))
        self.assertThat(stderr, matcher)
        self.assertEqual('', stdout)
 def test_merge_translations(self):
     """Running the script performs a translation merge."""
     # Import here to avoid autodetection by test runner.
     for packaging in set(TranslationMerger.findMergeablePackagings()):
         with person_logged_in(packaging.owner):
             packaging.destroySelf()
     job = make_translation_merge_job(self.factory)
     self.assertEqual(2, count_translations(job))
     transaction.commit()
     retcode, stdout, stderr = run_script(
         'scripts/rosetta/merge-existing-packagings.py', [],
         expect_returncode=0)
     merge_message = 'INFO    Merging %s/%s and %s/%s.\n' % (
         job.productseries.product.name, job.productseries.name,
         job.sourcepackagename.name, job.distroseries.name)
     self.assertEqual(
         merge_message +
         'INFO    Deleted POTMsgSets: 1.  TranslationMessages: 1.\n'
         'INFO    Merging template 1/2.\n'
         'INFO    Merging template 2/2.\n', stderr)
     self.assertEqual('', stdout)
     self.assertEqual(1, count_translations(job))
 def test_merge_translations(self):
     job = make_translation_merge_job(self.factory)
     TranslationSplitJob.create(
         job.productseries, job.distroseries, job.sourcepackagename)
     transaction.commit()
     retcode, stdout, stderr = run_script(
         'cronscripts/process-job-source.py',
         ['ITranslationPackagingJobSource'],
         expect_returncode=0)
     matcher = MatchesRegex(dedent("""\
         INFO    Creating lockfile: /var/lock/launchpad-process-job-source-ITranslationPackagingJobSource.lock
         INFO    Running synchronously.
         INFO    Running <.*?TranslationMergeJob.*?> \(ID .*\) in status Waiting
         INFO    Merging .* and .* in Ubuntu Distroseries.*
         INFO    Deleted POTMsgSets: 1.  TranslationMessages: 1.
         INFO    Running <.*?TranslationSplitJob.*?> \(ID .*\) in status Waiting
         INFO    Splitting .* and .* in Ubuntu Distroseries.*
         INFO    1 entries split.
         INFO    Ran 1 TranslationMergeJob jobs.
         INFO    Ran 1 TranslationSplitJob jobs.
         """))
     self.assertThat(stderr, matcher)
     self.assertEqual('', stdout)
 def test_merge_translations(self):
     """Running the script performs a translation merge."""
     # Import here to avoid autodetection by test runner.
     for packaging in set(TranslationMerger.findMergeablePackagings()):
         with person_logged_in(packaging.owner):
             packaging.destroySelf()
     job = make_translation_merge_job(self.factory)
     packaging = self.factory.makePackagingLink(job.productseries,
             job.sourcepackagename, job.distroseries)
     self.assertEqual(2, count_translations(job))
     transaction.commit()
     retcode, stdout, stderr = run_script(
         'scripts/rosetta/merge-existing-packagings.py', [],
         expect_returncode=0)
     merge_message = 'INFO    Merging %s/%s and %s/%s.\n' % (
         packaging.productseries.product.name,
         packaging.productseries.name,
         packaging.sourcepackagename.name, packaging.distroseries.name)
     self.assertEqual(
         merge_message +
         'INFO    Deleted POTMsgSets: 1.  TranslationMessages: 1.\n',
         stderr)
     self.assertEqual('', stdout)
     self.assertEqual(1, count_translations(job))