aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/subliminal_patch/test_subscene.py
blob: 72063aae31df2e6262e51b6efab1c619af91661f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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()