Fix published paths for transcoded media
This commit is contained in:
parent
3f33994cdc
commit
89d462e280
9 changed files with 956 additions and 114 deletions
|
|
@ -4,8 +4,9 @@ from scrapy.http import TextResponse
|
|||
from scrapy.settings import Settings
|
||||
|
||||
from repub import entrypoint as entrypoint_module
|
||||
from repub import settings as repub_settings
|
||||
from repub.spiders.rss_spider import RssFeedSpider
|
||||
from repub.utils import FileType, local_audio_path, local_image_path
|
||||
from repub.utils import FileType, local_audio_path, local_image_path, local_video_path
|
||||
|
||||
|
||||
def test_entrypoint_supports_file_feed_urls(tmp_path: Path, monkeypatch) -> None:
|
||||
|
|
@ -50,6 +51,8 @@ def test_rss_spider_rewrites_public_asset_urls_as_relative_paths() -> None:
|
|||
"REPUBLISHER_FILE_DIR": "files",
|
||||
"REPUBLISHER_AUDIO_DIR": "audio",
|
||||
"REPUBLISHER_VIDEO_DIR": "video",
|
||||
"REPUBLISHER_AUDIO": repub_settings.REPUBLISHER_AUDIO,
|
||||
"REPUBLISHER_VIDEO": repub_settings.REPUBLISHER_VIDEO,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -62,7 +65,14 @@ def test_rss_spider_rewrites_public_asset_urls_as_relative_paths() -> None:
|
|||
FileType.AUDIO,
|
||||
"https://example.com/media/podcast.mp3",
|
||||
)
|
||||
== f"audio/{local_audio_path('https://example.com/media/podcast.mp3')}"
|
||||
== f"audio/{local_audio_path('https://example.com/media/podcast.mp3')}-vbr7.mp3"
|
||||
)
|
||||
assert (
|
||||
spider.rewrite_file_url(
|
||||
FileType.VIDEO,
|
||||
"https://example.com/media/clip.mp4",
|
||||
)
|
||||
== f"video/{local_video_path('https://example.com/media/clip.mp4')}-720.mp4"
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -91,6 +101,8 @@ def test_rss_spider_keeps_items_with_empty_content_encoded() -> None:
|
|||
"REPUBLISHER_FILE_DIR": "files",
|
||||
"REPUBLISHER_AUDIO_DIR": "audio",
|
||||
"REPUBLISHER_VIDEO_DIR": "video",
|
||||
"REPUBLISHER_AUDIO": repub_settings.REPUBLISHER_AUDIO,
|
||||
"REPUBLISHER_VIDEO": repub_settings.REPUBLISHER_VIDEO,
|
||||
}
|
||||
)
|
||||
response = TextResponse(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue