def test_zip_to_html__no_original_name() -> None: manager = PreviewManager(cache_folder_path=CACHE_DIR, create_folder=True) assert manager.has_html_preview(file_path=IMAGE_FILE_PATH) is True path_to_file = manager.get_html_preview(file_path=IMAGE_FILE_PATH) assert os.path.exists(path_to_file) assert os.path.getsize(path_to_file) > 0 assert IMAGE_FILE_PATH.replace(".zip", "") not in path_to_file # test default not to put original file name in cache file assert manager.has_html_preview(file_path=IMAGE_FILE_PATH) is True path_to_file2 = manager.get_html_preview(file_path=IMAGE_FILE_PATH) assert os.path.exists(path_to_file) assert os.path.getsize(path_to_file) > 0 assert IMAGE_FILE_PATH.replace(".zip", "") not in path_to_file2
def test_zip_to_html(): manager = PreviewManager(cache_folder_path=CACHE_DIR, create_folder=True) input_filename = 'the_zip.zip' assert manager.has_html_preview(file_path=IMAGE_FILE_PATH, ) is True path_to_file = manager.get_html_preview(file_path=IMAGE_FILE_PATH, ) assert os.path.exists(path_to_file) assert os.path.getsize(path_to_file) > 0
def test_zip_to_html__no_original_name(): manager = PreviewManager(cache_folder_path=CACHE_DIR, create_folder=True) input_filename = 'the_zip.zip' path_to_file = manager.get_html_preview(file_path=os.path.join( CURRENT_DIR, input_filename), ) assert os.path.exists(path_to_file) assert os.path.getsize(path_to_file) > 0 assert input_filename.replace('.zip', '') not in path_to_file # test default not to put original file name in cache file path_to_file2 = manager.get_html_preview( file_path=os.path.join(CURRENT_DIR, input_filename)) assert os.path.exists(path_to_file) assert os.path.getsize(path_to_file) > 0 assert input_filename.replace('.zip', '') not in path_to_file2
def test_zip_to_html(): manager = PreviewManager(cache_folder_path=CACHE_DIR, create_folder=True) input_filename = 'the_zip.zip' path_to_file = manager.get_html_preview(file_path=os.path.join( CURRENT_DIR, input_filename), ) assert os.path.exists(path_to_file) assert os.path.getsize(path_to_file) > 0
def test_zip_to_html() -> None: manager = PreviewManager(cache_folder_path=CACHE_DIR, create_folder=True) assert manager.has_html_preview(file_path=IMAGE_FILE_PATH) is True path_to_file = manager.get_html_preview(file_path=IMAGE_FILE_PATH) assert os.path.exists(path_to_file) assert os.path.getsize(path_to_file) > 0
def test_dry_run_html() -> None: pm = PreviewManager(cache_folder_path=CACHE_DIR, create_folder=True) preview_path = pm.get_html_preview("/tmp/image.jpeg", dry_run=True) assert not os.path.exists(preview_path)