summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorVitiko <[email protected]>2022-12-20 17:22:49 -0400
committerVitiko <[email protected]>2022-12-20 17:22:49 -0400
commit1233026adc896055d73576e23e826cb6b8e3c5b2 (patch)
treeb736604bc5829ce2cff3320f221c84cddb199e5a /tests
parente6864a9001474ede32ccc980c0399ab2ee097956 (diff)
downloadbazarr-1233026adc896055d73576e23e826cb6b8e3c5b2.tar.gz
bazarr-1233026adc896055d73576e23e826cb6b8e3c5b2.zip
Subtitrarinoi provider: add several improvements
* Fix episode matches (#2018) * Use standard utils to download subtitles * Use standard utils to guess matches (partially implemented)
Diffstat (limited to 'tests')
-rw-r--r--tests/subliminal_patch/test_subtitrarinoi.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/subliminal_patch/test_subtitrarinoi.py b/tests/subliminal_patch/test_subtitrarinoi.py
new file mode 100644
index 000000000..816e8db4f
--- /dev/null
+++ b/tests/subliminal_patch/test_subtitrarinoi.py
@@ -0,0 +1,54 @@
+import pytest
+from subliminal_patch.providers.subtitrarinoi import SubtitrarinoiProvider
+from subliminal_patch.providers.subtitrarinoi import SubtitrarinoiSubtitle
+from subzero.language import Language
+
+romanian = Language("ron")
+
+
+def test_list_subtitles(episodes):
+ episode = episodes["breaking_bad_s01e01"]
+ with SubtitrarinoiProvider() as provider:
+ assert provider.list_subtitles(episode, [romanian])
+
+
+def subtitrari_subtitle():
+ yield SubtitrarinoiSubtitle(
+ romanian,
+ "https://www.subtitrari-noi.ro/7493-subtitrari noi.ro\ ",
+ 3,
+ "Sezonul 1 ep. 1-7 Sincronizari si pentru variantele HDTV x264 (Sincro atty)",
+ "Breaking Bad",
+ "tt0903747/",
+ "Alice",
+ "https://www.subtitrari-noi.ro/index.php?page=movie_details&act=1&id=7493",
+ 2008,
+ 4230,
+ True,
+ 1,
+ )
+
+
[email protected]("comment", ["season 01", "Sezonul 1 ep. 1-7", "S01"])
+def test_subtitle_get_matches_episode(subtitrari_subtitle, episodes, comment):
+ episode = episodes["breaking_bad_s01e01"]
+ episode.episode = 1
+ subtitrari_subtitle.comments = comment
+ assert {"season", "episode", "series", "imdb_id"}.issubset(
+ subtitrari_subtitle.get_matches(episode)
+ )
+
+
[email protected]("comment", ["season 02", "Sezonul 2 ep. 1-7", "version 01"])
+def test_subtitle_get_matches_episode_false(subtitrari_subtitle, episodes, comment):
+ episode = episodes["breaking_bad_s01e01"]
+ episode.episode = 1
+ subtitrari_subtitle.comments = comment
+ assert not {"season", "episode"}.issubset(subtitrari_subtitle.get_matches(episode))
+
+
+def test_provider_download_subtitle(subtitrari_subtitle):
+ with SubtitrarinoiProvider() as provider:
+ provider.download_subtitle(subtitrari_subtitle)
+ assert subtitrari_subtitle.is_valid()