~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/translations/tests/test_translationimportqueue.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-09-12 19:27:39 UTC
  • mfrom: (13814.2.12 bug-302449)
  • Revision ID: launchpad@pqm.canonical.com-20110912192739-l51qyzomz0dll9nw
[r=bac][bug=302449] Make sure TranslationImportQueue.addOrUpdateEntry
        doesn't hit a DB constraint on (importer, potemplate, path, target).

Show diffs side-by-side

added added

removed removed

Lines of Context:
429
429
            productseries=self.productseries)
430
430
        stripped_path = path.lstrip('/')
431
431
        self.assertEqual([stripped_path], self._getQueuePaths())
 
432
 
 
433
    def test_addOrUpdateEntry_detects_conflicts(self):
 
434
        pot = self.factory.makePOTemplate(translation_domain='domain')
 
435
        uploader = self.factory.makePerson()
 
436
        pofile = self.factory.makePOFile(potemplate=pot, language_code='fr')
 
437
 
 
438
        # Add an import queue entry with a single pofile for a template.
 
439
        tiqe1 = self.factory.makeTranslationImportQueueEntry(
 
440
            path=pofile.path, productseries=pot.productseries,
 
441
            potemplate=pot, uploader=uploader)
 
442
 
 
443
        # Add an import queue entry for a the same pofile, but done
 
444
        # directly on the pofile object (i.e. more specific).
 
445
        tiqe2 = self.factory.makeTranslationImportQueueEntry(
 
446
            path=pofile.path, productseries=pot.productseries,
 
447
            potemplate=pot, pofile=pofile, uploader=uploader)
 
448
 
 
449
        self.assertEquals(tiqe1, tiqe2)