Beispiel #1
0
def test_has_html_preview(file_path):
    manager = PreviewManager(cache_folder_path=CACHE_DIR, create_folder=True)
    with pytest.raises(UnsupportedMimeType):
        manager.has_text_preview(
            file_path=file_path,
            file_ext='.bin'
        )
def test_to_text():
    manager = PreviewManager(cache_folder_path=CACHE_DIR, create_folder=True)
    assert manager.has_text_preview(
        file_path=IMAGE_FILE_PATH
    ) is True
    path_to_file = manager.get_text_preview(
        file_path=IMAGE_FILE_PATH,
        force=True
    )
Beispiel #3
0
def test_to_text():
    manager = PreviewManager(cache_folder_path=CACHE_DIR, create_folder=True)
    assert manager.has_text_preview(
        file_path=IMAGE_FILE_PATH
    ) is False
    with pytest.raises(UnavailablePreviewType):
        path_to_file = manager.get_text_preview(
            file_path=IMAGE_FILE_PATH,
            force=True
        )
Beispiel #4
0
def test_zip_to_text() -> None:
    manager = PreviewManager(cache_folder_path=CACHE_DIR, create_folder=True)
    assert manager.has_text_preview(file_path=IMAGE_FILE_PATH) is True
    path_to_file = manager.get_text_preview(file_path=IMAGE_FILE_PATH)
    assert os.path.exists(path_to_file) is True
    assert os.path.getsize(path_to_file) > 0