def test_02_check_flavors_multiple_files(self): ''' check if thumbnails are generated for proper flavor when requesting multiple files ''' uri = [ "file:///home/" + user() + "/MyDocs/.images/image_01.jpeg", "file:///home/" + user() + "/MyDocs/.images/image_02.png", "file:///home/" + user() + "/MyDocs/.images/image_03.gif" ] mime = ["image/jpeg", "image/png", "image/gif"] thumb_name = [ createImageExt(name=uri[0], mime=mime[0], width=800, height=480, strings=["test_01_check_flavors_multiple"]), createImageExt(name=uri[1], mime=mime[1], width=800, height=480, strings=["test_01_check_flavors_multiple"]), createImageExt(name=uri[2], mime=mime[2], width=800, height=480, strings=["test_01_check_flavors_multiple"]) ] all_thumbs = getThumbnailFilepaths(uri) for flavor in getFlavorsList(): ''' ''' # this thumbnails should be created thumb_path = getThumbnailFlavorPath(uri, flavor) deleteFiles(all_thumbs) tumbler = Tumbler() tumbler.simple_Queue(uri, mime, flavor) self.assertEqual(areFilesExist(thumb_path), True, 'Thumbnail for proper flavor was not created!') self.assertEqual(tumbler.readyItemsCount(), 3, 'Wrong number of Ready items') self.assertEqual(tumbler.errorItemsCount(), 0, 'Wrong number of Error items') #cleanup deleteFiles(all_thumbs) deleteFiles(uri)
def _test_08_move_one_non_file_resource(self): ''' test if thumbnails are moved together with file if file is not a local resource''' # create a thumbnails (every flavor will get one thumbnail) uri = "http://www.imagegallery.com/DSC_001.jpeg" uri_dst = "http://www.imagegallery.com/DSC_002.jpeg" 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!') # call tumbler move cache function tumbler = Tumbler() tumbler.Cache_move( [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 was deleted also self.assertEqual(areFilesDeleted(thumbs), True, 'not all flavors of old thumbnail were deleted after move operation!') # .. and if new thumbnails exist self.assertEqual(areFilesExist(thumbs_dst), True, 'not all flavors of new thumbnail were created after move operation!') deleteFiles(uri_dst)
def test_09_move_single_file_when_tumbler_is_not_running(self): ''' test if thumbnails are moved together with file - in situation when 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" thumbs = createFakeThumbnail(uri) thumbs_dst = getThumbnailFilepaths(uri_dst) createFiles(uri_dst) # check if all target files exist self.assertEqual(areFilesExist(uri_dst), True, 'not all target uris were created!') # 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() self.assertEqual(isTumblerRunning(), False, 'Could not kill the Tumbler daemon.') # call tumbler move cache function tumbler = Tumbler() tumbler.Cache_move( [uri], [uri_dst] ) wait(800) # check if thumbnail (all flavors) for old file was deleted also self.assertEqual(areFilesDeleted(thumbs), True, 'not all flavors of old thumbnail were deleted after move operation!') # .. and if new thumbnails exist self.assertEqual(areFilesExist(thumbs_dst), True, 'not all flavors of new thumbnail were created after move operation!') deleteFiles(uri_dst)
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_07_move_multiple_files(self): ''' test if thumbnails are moved together with more than one file ''' # create a thumbnails (every flavor will get one thumbnail) uris = ["file:///home/" + user() + "/MyDocs/.image/DSC_001.jpeg", "file:///home/" + user() + "/MyDocs/.image/DSC_002.jpeg"] uris_dst = ["file:///home/" + user() + "/MyDocs/.image2/DSC_003.jpeg", "file:///home/" + user() + "/MyDocs/.image2/DSC_004.jpeg"] thumbs = createFakeThumbnails(uris) thumbs_dst = getThumbnailFilepaths(uris_dst) createFiles(uris_dst) # check if all target files exist self.assertEqual(areFilesExist(uris_dst), True, 'not all target could be created!') # 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 move cache function tumbler = Tumbler() tumbler.Cache_move( 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 was deleted also self.assertEqual(areFilesDeleted(thumbs), True, 'not all flavors of old thumbnail were deleted after move operation!') # .. and if new thumbnails exist self.assertEqual(areFilesExist(thumbs_dst), True, 'not all flavors of new thumbnail were created after move operation!') deleteFiles(uris_dst)
def _test_05_video_resizing(self): ''' check if videos are resized properly ''' #useTestFlavorsConf() - had to remove that and test on standard flavors only deleteAllThumbnails() tumbler = Tumbler() tumbler.setQuitOnError() video = ["file:///usr/share/tumbler-tests/data/size_352x288.mp4"] mime = ["video/mp4"] flavors = getFlavorsList() original_size = 352, 288 for flavor in flavors: tumbler.simple_Queue(video, mime, flavor) # get list of thumbnails which should be created thumbnails = getThumbnailFlavorPath(video[0], flavor) #print "Should generated thumbnail:", thumbnails # check if those thumbnails exists self.assertEqual(areFilesExist(thumbnails), True, 'Thumbnail has not been created!') # check if files are 'readable' as a image and do not have zero size self.assertEqual(areFilesProperImages(thumbnails), True, 'Not all thumbnails are proper image files!') # get size of the image size = getImageSize(thumbnails[0]) # calculate proper size for a thumbnail targetSize = calculateSizeSrcFlavor(original_size, flavor) #print "Orig:(", original_size, ") Min:(", getFlavorMinSize(flavor), ") Dst:(", getFlavorSize(flavor), ") -> (", targetSize, ")" # check if thumbnail has proper size self.assertEqual(size, targetSize)
def test_04_check_flavors_resizing(self): ''' check if thumbnails have proper sizes for every input size of the image ''' uri = "file:///home/" + user() + "/MyDocs/.images/image.png" # use png due to some problems with really small (like 1x1) jpeg images in python-imaging mime = "image/png" all_thumbs = getThumbnailFilepaths(uri) sizes = [ (1,1), (2,2), (1,1000), (1000,1), (20,50), (1000, 1000), (10,10), (3000, 3000), (4000, 3000), (5,1000), (1000,5)] for flavor in getFlavorsList(): for size in sizes: deleteFiles(uri) thumb_name = createImageExt(name=uri, mime=mime, width=size[0], height=size[1], strings=["test_04_check_flavors_resizing"]) # this thumbnail should be created thumb_path = getThumbnailFlavorPath(uri, flavor)[0] deleteFiles(all_thumbs) deleteFiles(thumb_path) tumbler = Tumbler() tumbler.simple_Queue([uri], [mime], flavor) target_size = calculateSizeSrcFlavor(size, flavor) errorMsg = "Orig:" + str(size) + " Min:" + str(getFlavorMinSize(flavor)) + " Dst:" + str(getFlavorSize(flavor)) + " -> should_be" + str(target_size) + " == is" + str(getImageSize(thumb_path)) self.assertEqual(areFilesExist(thumb_path), True, 'Thumbnail for proper flavor was not created! ' + thumb_path + ' should be created.') self.assertEqual(getImageSize(thumb_path), target_size, 'Image does not have a proper size for flavor ' + flavor + ':' + errorMsg) self.assertEqual(tumbler.readySignalCount(), 1, 'Wrong number of Ready signal') self.assertEqual(tumbler.errorSignalCount(), 0, 'Wrong number of Error signal') self.assertEqual(tumbler.readyItemsCount(), 1, 'Wrong number of Ready items') # cleanup deleteFiles(all_thumbs) deleteFiles(uri) deleteFiles(thumb_path)
def test_03_check_flavors_sizes(self): ''' check if thumbnails have proper size for particular flavors ''' uri = "file:///home/" + user() + "/MyDocs/.images/image.jpeg" mime = "image/jpeg" thumb_name = createImageExt(name=uri, width=300, height=560, strings=["test_03_check_flavors_sizes"]) all_thumbs = getThumbnailFilepaths(uri) for flavor in getFlavorsList(): ''' ''' # this thumbnail should be created thumb_path = getThumbnailFlavorPath(uri, flavor)[0] deleteFiles(all_thumbs) tumbler = Tumbler() tumbler.simple_Queue([uri], [mime], flavor) target_size = calculateSizeSrcFlavor((300, 560), flavor) self.assertEqual(areFilesExist(thumb_path), True, 'Thumbnail for proper flavor was not created! ' + thumb_path + ' should be created.') self.assertEqual(getImageSize(thumb_path), target_size, 'Image does not have a proper size for flavor ' + flavor + ': is ' + str(getImageSize(thumb_path)) + ' and should be ' + str(target_size)) self.assertEqual(tumbler.readySignalCount(), 1, 'Wrong number of Ready signal') self.assertEqual(tumbler.errorSignalCount(), 0, 'Wrong number of Error signal') self.assertEqual(tumbler.readyItemsCount(), 1, 'Wrong number of Ready items') deleteFiles(thumb_path) # cleanup deleteFiles(all_thumbs) deleteFiles(uri)
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)
def test_03_delete_non_existing_file(self): ''' test if requesting for delete of non existing thumbnail does not crash the tumbler''' uri = "file:///home/" + user() + "/MyDocs/.image/DSC_001.jpeg" thumbs = getThumbnailFilepaths(uri) deleteFiles(thumbs) self.assertEqual(areFilesDeleted(thumbs), True, 'Thumbnail could not be deleted for test.') # call tumbler delete cache function tumbler = Tumbler() tumbler.Cache_delete( [uri] ) wait(200.0) self.assertEqual(isTumblerRunning(), True, 'Tumbler crashed after request of move of non existing thumbnail.')
def test_05_delete_wrong_uri(self): ''' test if requesting for delete of not properly formated URI does not end up with Tumbler crash ''' startTumblerProcess(); self.assertEqual(isTumblerRunning(), True, 'Tumbler could not be started!') # no schema, no path, empty string, only space, trash uri = ["/home/" + user() + "/MyDocs/.image/DSC_001.jpeg", "DSC_001.jpeg", "", " ", "#!@$:;<>?/.,"] thumbs = getThumbnailFilepaths(uri[0]) deleteFiles(thumbs) self.assertEqual(areFilesDeleted(thumbs), True, 'Thumbnails could not be deleted for test.') # call tumbler delete cache function tumbler = Tumbler() tumbler.Cache_delete( uri ) wait(200.0) self.assertEqual(isTumblerRunning(), True, 'Tumbler crashed after request of move of non existing thumbnail.')
def test_10_move_multiple_files_bad_uris(self): ''' test if Tumbler is working properly with bad uris in parameters ''' # create a thumbnails (every flavor will get one thumbnail) uris = ["file:///home/" + user() + "/MyDocs/.image/DSC_001.jpeg", "foo", ""] uris_dst = ["bar", "file:///home/" + user() + "/MyDocs/.image2/DSC_004.jpeg", "234@#$@!$:;[}.<"] # call tumbler move cache function tumbler = Tumbler() tumbler.Cache_move( uris, uris_dst ) delay = 0 while(isTumblerRunning() and (delay < 1000)): wait(200) delay += 200 # check if thumbnail (all flavors) for old file was deleted also self.assertEqual(isTumblerRunning(), True, 'Tumbler crashed after wrong request')
def test_03_check_background(self): ''' check if thumbnails are generated for background scheduler ''' uri = "file:///home/" + user() + "/MyDocs/.images/image.jpeg" mime = "image/jpeg" deleteFiles(uri) thumb_name = createImageExt(name=uri, width=200, height=200, strings=["test_03_check_background"]) all_thumbs = getThumbnailFilepaths(uri) # cleanup before test deleteFiles(all_thumbs) for flavor in getFlavorsList(): ''' ''' # this thumbnail should be created thumb_path = getThumbnailFlavorPath(uri, flavor)[0] deleteFiles(all_thumbs) tumbler = Tumbler() tumbler.simple_Queue([uri], [mime], flavor, "background") self.assertEqual( areFilesExist(thumb_path), True, 'Thumbnail for scheduler background was not created!') self.assertEqual( tumbler.readySignalCount(), 1, 'Wrong number of Ready signal: ' + str(tumbler.readySignalCount())) self.assertEqual( tumbler.errorSignalCount(), 0, 'Wrong number of Error signal: ' + str(tumbler.errorSignalCount())) self.assertEqual( tumbler.readyItemsCount(), 1, 'Wrong number of Ready items: ' + str(tumbler.readyItemsCount()) + ' Items: ' + str(tumbler.signal_ready)) deleteFiles(thumb_path) # cleanup deleteFiles(all_thumbs) deleteFiles(uri)
def test_04_delete_file_when_tumbler_is_not_running(self): ''' test if thumbnails are deleted together with file - when tumbler is not running yet ''' # create a thumbnails (every flavor will get one thumbnail) uri = "file:///home/" + user() + "/MyDocs/.image/DSC_001.jpeg" thumbs = createFakeThumbnail(uri) # check if all flavors exist self.assertEqual(areFilesExist(thumbs), True, 'not all flavors of thumbnail were created!') # kill Tumbler killTumblerProcess() self.assertEqual(isTumblerRunning(), False, 'Could not kill the Tumbler daemon.') # call tumbler delete cache function tumbler = Tumbler() tumbler.Cache_delete( [uri] ) wait(800) # check if thumbnail (all flavors) was deleted also self.assertEqual(areFilesDeleted(thumbs), True, 'not all flavors of thumbnail were deleted!')
def test_02_png_format(self): ''' check if PNG images are properly thumbnailed ''' flavor = "normal" data = [ [ addFileSchema(self.dataDir + "image_01.png"), addFileSchema(self.dataDir + "image_02.png"), addFileSchema(self.dataDir + "image_03.png"), addFileSchema(self.dataDir + "image_04.png"), ], [ "image/png", "image/png", "image/png", "image/png", ], [ (100, 100), (450, 450), (800, 480), (15, 15), ], ] for i in range(len(data[0])): # creating images createImageExt(name=data[0][i], mime=data[1][i], width=data[2][i][0], height=data[2][i][1], strings=["test_02_png_format"]) # ask for thumbnails tumbler = Tumbler() tumbler.simple_Queue(data[0], data[1], flavor=flavor) # get list of thumbnails which should be created thumbnails = getThumbnailFlavorPath(data[0], flavor) # check if those thumbnails exists self.assertEqual(areFilesExist(thumbnails), True, 'Not all thumbnails were created for PNG images!') # check if files are 'readable' as a image and do not have zero size self.assertEqual(areFilesProperImages(thumbnails), True, 'Not all thumbnails are proper image files!')
def _test_04_mpeg_format_insignificant(self): ''' check if MPEG videos are properly thumbnailed ''' videos = self.getAllVideosWithFormat("mpeg") flavor = "normal" mime = [] for tmp in videos: mime.append("video/mpeg") tumbler = Tumbler() tumbler.setQuitOnError() tumbler.simple_Queue(videos, mime, flavor) # get list of thumbnails which should be created thumbnails = getThumbnailFlavorPath(videos, flavor) # check if those thumbnails exists self.assertEqual(areFilesExist(thumbnails), True, 'Not all thumbnails were created for MPEG videos!') # cleanup deleteAllThumbnails()
def test_01_delete_single_file(self): ''' test if thumbnails are deleted together with file ''' # create a thumbnails (every flavor will get one thumbnail) uri = "file:///home/" + user() + "/MyDocs/.image/DSC_001.jpeg" thumbs = createFakeThumbnail(uri) # check if all flavors exist self.assertEqual(areFilesExist(thumbs), True, 'not all flavors of thumbnail were created!') # call tumbler delete cache function tumbler = Tumbler() tumbler.Cache_delete( [uri] ) delay = 0 while(not areFilesDeleted(thumbs) and delay < 4000): wait(200) delay += 200 # check if thumbnail (all flavors) was deleted also self.assertEqual(areFilesDeleted(thumbs), True, 'not all flavors of thumbnail were deleted!')
def test_02_delete_multiple_files(self): ''' test if thumbnails are deleted together with deletiion of more than one file ''' # create a thumbnails (every flavor will get one thumbnail) uris = ["file:///home/" + user() + "/MyDocs/.image/DSC_001.jpeg", "file:///home/" + user() + "/MyDocs/.image/DSC_002.jpeg", "file:///home/" + user() + "/MyDocs/.image/DSC_003.jpeg"] thumbs = createFakeThumbnails(uris) # check if all flavors exist self.assertEqual(areFilesExist(thumbs), True, 'not all flavors of thumbnail were created!') # call tumbler delete cache function tumbler = Tumbler() tumbler.Cache_delete( uris ) delay = 0 while(not areFilesDeleted(thumbs) and delay < 4000): wait(200) delay += 200 # check if thumbnails (all flavors) were deleted also self.assertEqual(areFilesDeleted(thumbs), True, 'not all flavors of thumbnail were deleted!')
def test_11_move_different_arrays_length(self): ''' test if Tumbler is working properly with different length of arrays in parameters ''' # create a thumbnails (every flavor will get one thumbnail) uris = ["file:///home/" + user() + "/MyDocs/.image/DSC_001.jpeg", "file:///home/" + user() + "/MyDocs/.image2/DSC_004.jpeg"] uris_dst = ["file:///home/user" + user() + "/MyDocs/.image/DSC_003.jpeg"] # call tumbler move cache function tumbler = Tumbler() try: tumbler.Cache_move( uris, uris_dst ) except: ''' do nothing ''' delay = 0 while(isTumblerRunning() and (delay < 1000)): wait(200) delay += 200 # check if thumbnail (all flavors) for old file was deleted also self.assertEqual(isTumblerRunning(), True, 'Tumbler crashed after wrong request: different length of arrays')
def test_05_check_foreground_signal_count(self): ''' check if Tumbler sends more than one one Ready signal for foreground scheduler ''' # first create lots of images to pass to Tumbler flavor = "normal" uris = [] thumbs = [] mimes = [] for i in range(100): uri = "file:///home/" + user() + "/MyDocs/.images/image_" + str( i) + ".jpeg" uris.append(uri) mimes.append("image/jpeg") deleteFiles(uri) createImageExt(name=uri, width=110, height=110, strings=[ "test_04_check_background_signal_count(" + str(i) + ")" ]) thumbs.append(getThumbnailFlavorPath(uri, flavor)[0]) # make sure that thumbnails do not exist deleteFiles(thumbs) # make a request with backround scheduler tumbler = Tumbler() tumbler.setLogLevel(2) tumbler.simple_Queue(uris, mimes, flavor, "foreground") self.assertNotEqual( tumbler.readySignalCount(), 1, 'Wrong number of Ready signal: ' + str(tumbler.readySignalCount())) self.assertEqual( tumbler.readyItemsCount(), 100, 'Wrong number of Ready items: ' + str(tumbler.readyItemsCount())) # clean up deleteFiles(uris) deleteFiles(thumbs)
def test_12_move_multiple_files_some_bad(self): ''' test if thumbnails are moved together with more than one file when some parameters are wrong ''' # create a thumbnails (every flavor will get one thumbnail) one_src_uri = "file:///home/" + user() + "/MyDocs/.image/DSC_001.jpeg" two_src_uri = "file:///home/" + user() + "/MyDocs/.image/DSC_002.jpeg" good_dst_uri = "file:///home/" + user() + "/MyDocs/.image2/DSC_003.jpeg" bad_dst_uri = "file:///home/" + user() + "/MyDocs/.image2/non_existing_image.jpeg" uris = [one_src_uri, two_src_uri ] uris_dst = [good_dst_uri, bad_dst_uri] thumbs = createFakeThumbnails(uris) thumbs_dst = getThumbnailFilepaths(uris_dst) createFiles(good_dst_uri) # check if all target files exist self.assertEqual(areFilesExist(good_dst_uri), True, 'target image could not be created!') # 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 move cache function tumbler = Tumbler() tumbler.Cache_move( uris, uris_dst ) thumbs_should_exists = getThumbnailFilepaths([two_src_uri, good_dst_uri]) thumbs_should_not_exists = getThumbnailFilepaths([one_src_uri, bad_dst_uri]) delay = 0 while((not areFilesExist(thumbs_should_exists)) and (delay < 4000)): wait(200) delay += 200 # check if thumbnail (all flavors) for old file was deleted also self.assertEqual(areFilesDeleted(thumbs_should_not_exists), True, 'not all flavors of old thumbnail were deleted after move operation!') # .. and if new thumbnails exist self.assertEqual(areFilesExist(thumbs_should_exists), True, 'not all flavors of new thumbnail were created after move operation!') deleteFiles(thumbs_should_exists)
def test_01_check_flavors(self): ''' check if thumbnails are generated for proper flavor ''' uri = "file:///home/" + user() + "/MyDocs/.images/image.jpeg" mime = "image/jpeg" thumb_name = createImageExt(name=uri, width=800, height=480, strings=["test_01_check_flavors"]) all_thumbs = getThumbnailFilepaths(uri) for flavor in getFlavorsList(): ''' ''' # this thumbnail should be created thumb_path = getThumbnailFlavorPath(uri, flavor)[0] deleteFiles(all_thumbs) tumbler = Tumbler() tumbler.simple_Queue([uri], [mime], flavor) self.assertEqual(areFilesExist(thumb_path), True, 'Thumbnail for proper flavor was not created! ' + thumb_path + ' should be created.') self.assertEqual(tumbler.readySignalCount(), 1, 'Wrong number of Ready signal') self.assertEqual(tumbler.errorSignalCount(), 0, 'Wrong number of Error signal') self.assertEqual(tumbler.readyItemsCount(), 1, 'Wrong number of Ready items') # cleanup deleteFiles(all_thumbs) deleteFiles(uri)