Fix warnings from Ruff and ffmpeg
This commit is contained in:
@ -11,8 +11,7 @@ def test_generate_html_for_videos() -> None:
|
||||
domain: str = os.environ["SERVE_DOMAIN"]
|
||||
|
||||
# Remove trailing slash from domain
|
||||
if domain.endswith("/"):
|
||||
domain = domain[:-1]
|
||||
domain = domain.removesuffix("/")
|
||||
|
||||
# Delete the old HTML file if it exists
|
||||
if Path.exists(Path("Uploads/test_video.mp4.html")):
|
||||
|
@ -1,6 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import imghdr
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
@ -24,13 +23,11 @@ def test_make_thumbnail() -> None:
|
||||
domain: str = domain[:-1]
|
||||
|
||||
# Remove thumbnail if it exists
|
||||
if Path.exists(Path(f"{settings.upload_folder}/test.mp4.jpg")):
|
||||
Path.unlink(Path(f"{settings.upload_folder}/test.mp4.jpg"))
|
||||
thumbnail_path = Path(f"{settings.upload_folder}/test.mp4.jpg")
|
||||
if thumbnail_path.exists():
|
||||
thumbnail_path.unlink()
|
||||
|
||||
thumbnail: str = make_thumbnail(TEST_FILE, "test.mp4")
|
||||
|
||||
# Check if thumbnail is a jpeg.
|
||||
assert imghdr.what(f"{settings.upload_folder}/test.mp4.jpg") == "jpeg"
|
||||
|
||||
# Check if it returns the correct URL.
|
||||
assert thumbnail == f"{domain}/test.mp4.jpg"
|
||||
|
Reference in New Issue
Block a user