예제 #1
0
 def test_ParseEmptyParallelUploadTrackerFile(self):
   """Tests _ParseParallelUploadTrackerFile with an empty tracker file."""
   tracker_file_lock = CreateLock()
   fpath = self.CreateTempFile(file_name='foo', contents='')
   expected_objects = []
   (actual_prefix, actual_objects) = _ParseParallelUploadTrackerFile(
       fpath, tracker_file_lock)
   self.assertEqual(actual_objects, expected_objects)
   self.assertIsNotNone(actual_prefix)
예제 #2
0
 def test_ParseEmptyParallelUploadTrackerFile(self):
     """Tests _ParseParallelUploadTrackerFile with an empty tracker file."""
     tracker_file_lock = CreateLock()
     fpath = self.CreateTempFile(file_name='foo', contents='')
     expected_objects = []
     (actual_prefix, actual_objects) = _ParseParallelUploadTrackerFile(
         fpath, tracker_file_lock)
     self.assertEqual(actual_objects, expected_objects)
     self.assertIsNotNone(actual_prefix)
예제 #3
0
 def test_ParseParallelUploadTrackerFile(self):
   """Tests the _ParseParallelUploadTrackerFile function."""
   tracker_file_lock = CreateLock()
   random_prefix = '123'
   objects = ['obj1', '42', 'obj2', '314159']
   contents = '\n'.join([random_prefix] + objects)
   fpath = self.CreateTempFile(file_name='foo', contents=contents)
   expected_objects = [ObjectFromTracker(objects[2 * i], objects[2 * i + 1])
                       for i in range(0, len(objects) / 2)]
   (actual_prefix, actual_objects) = _ParseParallelUploadTrackerFile(
       fpath, tracker_file_lock)
   self.assertEqual(random_prefix, actual_prefix)
   self.assertEqual(expected_objects, actual_objects)
예제 #4
0
 def test_ParseParallelUploadTrackerFile(self):
     """Tests the _ParseParallelUploadTrackerFile function."""
     tracker_file_lock = CreateLock()
     random_prefix = '123'
     objects = ['obj1', '42', 'obj2', '314159']
     contents = '\n'.join([random_prefix] + objects)
     fpath = self.CreateTempFile(file_name='foo', contents=contents)
     expected_objects = [
         ObjectFromTracker(objects[2 * i], objects[2 * i + 1])
         for i in range(0,
                        len(objects) / 2)
     ]
     (actual_prefix, actual_objects) = _ParseParallelUploadTrackerFile(
         fpath, tracker_file_lock)
     self.assertEqual(random_prefix, actual_prefix)
     self.assertEqual(expected_objects, actual_objects)