def test_addOrUpdateEntriesFromTarball_only_translation_files(self):
     # Only files with the right extensions are added.
     files = dict((self._makeFile(), ))
     tarfile_content = LaunchpadWriteTarFile.files_to_stream(files)
     self.import_queue.addOrUpdateEntriesFromTarball(
         tarfile_content,
         True,
         self.importer,
         productseries=self.productseries)
     self.assertEqual([], self._getQueuePaths())
 def test_addOrUpdateEntriesFromTarball_path(self):
     # File names are store with full path.
     files = dict((self._makeFile('pot', 'directory'), ))
     tarfile_content = LaunchpadWriteTarFile.files_to_stream(files)
     self.import_queue.addOrUpdateEntriesFromTarball(
         tarfile_content,
         True,
         self.importer,
         productseries=self.productseries)
     self.assertEqual(files.keys(), self._getQueuePaths())
 def test_addOrUpdateEntriesFromTarball_path_leading_slash(self):
     # Leading slashes are stripped from path names.
     path, content = self._makeFile('pot', '/directory')
     files = dict(((path, content), ))
     tarfile_content = LaunchpadWriteTarFile.files_to_stream(files)
     self.import_queue.addOrUpdateEntriesFromTarball(
         tarfile_content,
         True,
         self.importer,
         productseries=self.productseries)
     stripped_path = path.lstrip('/')
     self.assertEqual([stripped_path], self._getQueuePaths())
 def test_addOrUpdateEntriesFromTarball_baseline(self):
     # Files from a tarball are placed in the queue.
     files = dict((
         self._makeFile('pot'),
         self._makeFile('po'),
         self._makeFile('xpi'),
     ))
     tarfile_content = LaunchpadWriteTarFile.files_to_stream(files)
     self.import_queue.addOrUpdateEntriesFromTarball(
         tarfile_content,
         True,
         self.importer,
         productseries=self.productseries)
     self.assertContentEqual(files.keys(), self._getQueuePaths())