diff options
author | Vitiko <[email protected]> | 2023-02-02 16:24:11 -0400 |
---|---|---|
committer | Vitiko <[email protected]> | 2023-02-02 16:24:11 -0400 |
commit | 3a0085a155ad81784b6132ec1b8048b4d626bf95 (patch) | |
tree | 0d624001c55367b27a2ebc3db156648ac9b5c17e /tests | |
parent | 47aff78ab0acb8e1c4ebabed455e1a956392da04 (diff) | |
download | bazarr-3a0085a155ad81784b6132ec1b8048b4d626bf95.tar.gz bazarr-3a0085a155ad81784b6132ec1b8048b4d626bf95.zip |
Add Subscene Cloudscraper Provider [Experimental]
An alternative module to the Subscene provider.
* Uses similar parsing mechanisms of the Subfm2 provider
* Uses cloudscraper for server calls
* No login required
Not yet implemented in Web UI.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/subliminal_patch/test_subscene.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/subliminal_patch/test_subscene.py b/tests/subliminal_patch/test_subscene.py new file mode 100644 index 000000000..72063aae3 --- /dev/null +++ b/tests/subliminal_patch/test_subscene.py @@ -0,0 +1,50 @@ +from subliminal_patch.providers import subscene_cloudscraper as subscene + + +def test_provider_scraper_call(): + with subscene.SubsceneProvider() as provider: + result = provider._scraper_call( + "https://subscene.com/subtitles/breaking-bad-fifth-season" + ) + assert result.status_code == 200 + + +def test_provider_gen_results(): + with subscene.SubsceneProvider() as provider: + assert list(provider._gen_results("Breaking Bad")) + + +def test_provider_search_movie(): + with subscene.SubsceneProvider() as provider: + result = provider._search_movie("Taxi Driver", 1976) + assert result == "/subtitles/taxi-driver" + + +def test_provider_find_movie_subtitles(languages): + with subscene.SubsceneProvider() as provider: + result = provider._find_movie_subtitles( + "/subtitles/taxi-driver", languages["en"] + ) + assert result + + +def test_provider_search_tv_show_season(): + with subscene.SubsceneProvider() as provider: + result = provider._search_tv_show_season("The Wire", 1) + assert result == "/subtitles/the-wire--first-season" + + +def test_provider_find_episode_subtitles(languages): + with subscene.SubsceneProvider() as provider: + result = provider._find_episode_subtitles( + "/subtitles/the-wire--first-season", 1, 1, languages["en"] + ) + assert result + + +def test_provider_download_subtitle(languages): + path = "https://subscene.com/subtitles/the-wire--first-season/english/115904" + subtitle = subscene.SubsceneSubtitle(languages["en"], path, "", 1) + with subscene.SubsceneProvider() as provider: + provider.download_subtitle(subtitle) + assert subtitle.is_valid() |