summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorVitiko <[email protected]>2022-04-16 16:44:00 -0400
committerVitiko <[email protected]>2022-04-16 16:44:00 -0400
commit31e4f835cf28bd1f5c4840a958126fce046591ee (patch)
treeffceddcf5aae85e82761f082f4885bced1aac5a5 /tests
parentd3e3e31fa13bce4d8ea29c2c834b04e0b061e287 (diff)
downloadbazarr-31e4f835cf28bd1f5c4840a958126fce046591ee.tar.gz
bazarr-31e4f835cf28bd1f5c4840a958126fce046591ee.zip
SuperSubtitles Provider: fix filetype detection
Diffstat (limited to 'tests')
-rw-r--r--tests/subliminal_patch/conftest.py1
-rw-r--r--tests/subliminal_patch/test_supersubtitles.py107
2 files changed, 108 insertions, 0 deletions
diff --git a/tests/subliminal_patch/conftest.py b/tests/subliminal_patch/conftest.py
index e9c539a62..167acfad1 100644
--- a/tests/subliminal_patch/conftest.py
+++ b/tests/subliminal_patch/conftest.py
@@ -27,6 +27,7 @@ def movies():
resolution="1080p",
source="Web",
# other="Rip",
+ imdb_id="tt1160419",
alternative_titles=["Dune: Part One"],
audio_codec="Dolby Digital",
video_codec="H.264",
diff --git a/tests/subliminal_patch/test_supersubtitles.py b/tests/subliminal_patch/test_supersubtitles.py
new file mode 100644
index 000000000..6111cabc0
--- /dev/null
+++ b/tests/subliminal_patch/test_supersubtitles.py
@@ -0,0 +1,107 @@
+# -*- coding: utf-8 -*-
+
+import pytest
+from subliminal_patch.providers.supersubtitles import SuperSubtitlesProvider
+from subliminal_patch.providers.supersubtitles import SuperSubtitlesSubtitle
+from subliminal_patch.core import Episode
+from subzero.language import Language
+
+
+def episode():
+ episode = {
+ "name": "/tv/All of Us Are Dead/Season 1/All of Us Are Dead - S01E11 - Episode 11 WEBDL-1080p.mp4",
+ "source": "Web",
+ "release_group": None,
+ "resolution": "1080p",
+ "video_codec": None,
+ "audio_codec": None,
+ "imdb_id": None,
+ "subtitle_languages": set(),
+ "streaming_service": None,
+ "edition": None,
+ "series": "All of Us Are Dead",
+ "season": 1,
+ "episode": 11,
+ "title": "Episode 11",
+ "year": None,
+ "original_series": True,
+ "tvdb_id": None,
+ "series_tvdb_id": None,
+ "series_imdb_id": None,
+ "alternative_series": [],
+ }
+ return Episode(**episode)
+
+
+def test_list_episode_subtitles(episode):
+ language = Language.fromalpha2("en")
+
+ with SuperSubtitlesProvider() as provider:
+ assert provider.list_subtitles(episode, {language})
+
+
+def test_download_episode_subtitle(episode):
+ subtitle = SuperSubtitlesSubtitle(
+ Language.fromalpha2("en"),
+ "https://www.feliratok.info/index.php?action=letolt&felirat=1643361676",
+ 1643361676,
+ "All of us are dead",
+ 1,
+ 11,
+ "",
+ [
+ "NF.WEB-DL.1080p-TEPES",
+ "NF.WEBRip.1080p-TEPES",
+ "WEBRip-ION10",
+ "WEBRip-ION265",
+ "WEBRip.1080p-RARBG",
+ ],
+ "",
+ "",
+ "",
+ asked_for_episode=True,
+ )
+ assert subtitle.get_matches(episode)
+
+ with SuperSubtitlesProvider() as provider:
+ provider.download_subtitle(subtitle)
+ assert subtitle.is_valid()
+
+
+def test_list_and_download_movie_subtitles(movies):
+ movie = movies["dune"]
+ language = Language.fromalpha2("en")
+
+ with SuperSubtitlesProvider() as provider:
+ assert provider.list_subtitles(movie, {language})
+
+
+def test_download_movie_subtitle(movies):
+ movie = movies["dune"]
+
+ subtitle = SuperSubtitlesSubtitle(
+ Language.fromalpha2("en"),
+ "https://www.feliratok.info/index.php?action=letolt&felirat=1634579718",
+ 1634579718,
+ "Dune",
+ 0,
+ 0,
+ "",
+ [
+ "NF.WEB-DL.1080p-TEPES",
+ "NF.WEBRip.1080p-TEPES",
+ "WEBRip-ION10",
+ "WEBRip-ION265",
+ "WEBRip.1080p-RARBG",
+ ],
+ "",
+ "",
+ "",
+ asked_for_episode=None,
+ )
+ assert subtitle.get_matches(movie)
+
+ with SuperSubtitlesProvider() as provider:
+ provider.download_subtitle(subtitle)
+ assert subtitle.is_valid()