def test_16_copy_single_file_when_tumbler_is_not_running(self): ''' test if thumbnails are copied together with file if tumbler is not running on request time ''' # create a thumbnails (every flavor will get one thumbnail) uri = "file:///home/" + user() + "/MyDocs/.image/DSC_001.jpeg" uri_dst = "file:///home/" + user() + "/MyDocs/.image/DSC_002.jpeg" createFiles(uri_dst) thumbs = createFakeThumbnail(uri) thumbs_dst = getThumbnailFilepaths(uri_dst) # check if all flavors exist for src self.assertEqual(areFilesExist(thumbs), True, 'not all flavors of thumbnail were created!') # check if any flavor exist for dst (should NOT - we delete them before) deleteFiles(thumbs_dst) self.assertEqual(areFilesDeleted(thumbs_dst), True, 'some destination thumbnails exists!') killTumblerProcess() # call tumbler copy cache function tumbler = Tumbler() tumbler.Cache_copy( [uri], [uri_dst] ) delay = 0 while(not areFilesExist(thumbs_dst) and delay < 4000): wait(200) delay += 200 # check if thumbnail (all flavors) for old file is kept self.assertEqual(areFilesExist(thumbs), True, 'some old thumbnail was deleted during copy operation!') # .. and also if new thumbnail exist self.assertEqual(areFilesExist(thumbs_dst), True, 'not all flavors of new thumbnail were created after copy operation!') deleteFiles(uri_dst)
def _test_15_copy_multiple_file_non_local_resources(self): ''' test if thumbnails are copied together with multiple files which source or destination are not local resource ''' # create a thumbnails (every flavor will get one thumbnail) uris = ["http://www.imagegallery.com/DSC_001.jpeg", "file:///home/user/MyDocs/.image/DSC_002.jpeg"] uris_dst = ["file:///home/" + user() + "/MyDocs/.image/DSC_003.jpeg", "http://www.imagegallery.com/DSC_004.jpeg"] createFiles(uris_dst[0]) thumbs = createFakeThumbnails(uris) thumbs_dst = getThumbnailFilepaths(uris_dst) # check if all flavors exist for src self.assertEqual(areFilesExist(thumbs), True, 'not all flavors of thumbnail were created!') # check if any flavor exist for dst (should NOT - we delete them before) deleteFiles(thumbs_dst) self.assertEqual(areFilesDeleted(thumbs_dst), True, 'some destination thumbnails exists!') # call tumbler copy cache function tumbler = Tumbler() tumbler.Cache_copy( uris, uris_dst ) delay = 0 while(not areFilesExist(thumbs_dst) and delay < 4000): wait(200) delay += 200 # check if thumbnail (all flavors) for old file is kept self.assertEqual(areFilesExist(thumbs), True, 'some old thumbnail was deleted during copy operation!') # .. and also if new thumbnail exist self.assertEqual(areFilesExist(thumbs_dst), True, 'not all thumbnails were created after copy operation!') deleteFiles(uris_dst)