示例#1
0
 def test_both_templates(self):
     """A Packaging with product and package templates is included."""
     packaging = self.makePackagingLink()
     self.factory.makePOTemplate(productseries=packaging.productseries)
     self.factory.makePOTemplate(sourcepackage=packaging.sourcepackage)
     self.assertContentEqual(
         [packaging], TranslationMerger.findMergeablePackagings())
示例#2
0
 def test_non_ubuntu(self):
     """A Packaging not for Ubuntu is ignored."""
     packaging = self.makePackagingLink(non_ubuntu=True)
     self.factory.makePOTemplate(productseries=packaging.productseries)
     self.factory.makePOTemplate(sourcepackage=packaging.sourcepackage)
     self.assertContentEqual(
         [], TranslationMerger.findMergeablePackagings())
示例#3
0
 def test_multiple_templates(self):
     """A Packaging with multiple templates appears only once."""
     packaging = self.makePackagingLink()
     self.factory.makePOTemplate(productseries=packaging.productseries)
     self.factory.makePOTemplate(productseries=packaging.productseries)
     self.factory.makePOTemplate(sourcepackage=packaging.sourcepackage)
     self.factory.makePOTemplate(sourcepackage=packaging.sourcepackage)
     self.assertContentEqual(
         [packaging], TranslationMerger.findMergeablePackagings())
 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))
示例#5
0
 def test_no_package_template(self):
     """A Packaging with no sourcepackage templates is ignored."""
     packaging = self.makePackagingLink()
     self.factory.makePOTemplate(productseries=packaging.productseries)
     self.assertContentEqual(
         [], TranslationMerger.findMergeablePackagings())
示例#6
0
 def test_no_templates(self):
     """A Packaging with no templates is ignored."""
     self.makePackagingLink()
     self.assertContentEqual(
         [], TranslationMerger.findMergeablePackagings())
示例#7
0
 def setUp(self):
     """Remove sample data to simplify tests."""
     super(TestFindMergablePackagings, self).setUp()
     for packaging in set(TranslationMerger.findMergeablePackagings()):
         with person_logged_in(packaging.owner):
             packaging.destroySelf()