chore: checkpoint baseline (routers, tests, pyproject)

This commit is contained in:
authentik Default Admin 2026-05-17 11:40:35 +01:00
parent a58498a315
commit 986f1dfef4
37 changed files with 2527 additions and 1664 deletions

48
tests/test_extractors.py Normal file
View file

@ -0,0 +1,48 @@
"""Tests for URL extractors."""
from src.extractors import extract_media_url
from src.extractors.imgur import extract_imgur_url
class TestExtractMediaUrl:
def test_direct_image_passthrough(self):
url = "https://i.redd.it/test123.jpg"
result_url, result_type = extract_media_url(url, "image")
assert result_url == url
assert result_type == "image"
def test_unknown_domain_passthrough(self):
url = "https://example.com/image.jpg"
result_url, result_type = extract_media_url(url, "image")
assert result_url == url
assert result_type == "image"
class TestImgurExtractor:
def test_direct_imgur_url(self):
url = "https://i.imgur.com/abc123.jpg"
result_url, result_type = extract_imgur_url(url)
assert result_url == url
assert result_type == "image"
def test_gifv_to_mp4(self):
url = "https://i.imgur.com/abc123.gifv"
result_url, result_type = extract_imgur_url(url)
assert result_url == "https://i.imgur.com/abc123.mp4"
assert result_type == "video"
def test_imgur_page_url(self):
url = "https://imgur.com/abc123"
result_url, result_type = extract_imgur_url(url)
assert result_url == "https://i.imgur.com/abc123.jpg"
assert result_type == "image"
def test_imgur_album_unsupported(self):
url = "https://imgur.com/a/abc123"
result_url, _result_type = extract_imgur_url(url)
assert result_url is None
def test_imgur_gallery_unsupported(self):
url = "https://imgur.com/gallery/abc123"
result_url, _result_type = extract_imgur_url(url)
assert result_url is None