Esempio n. 1
0
def test_getter(item, category):
    sleep(PAUSE_BETWEEN_REQUESTS)
    fetcher = anidb_parser.AnidbFetcher(user_agent=USER_AGENT)

    result = fetcher.get_item(item, category)

    assert isinstance(result.text, str)
Esempio n. 2
0
def test_search(text, category):
    #waiting between requests to avoid getting 403
    sleep(PAUSE_BETWEEN_REQUESTS)
    fetcher = anidb_parser.AnidbFetcher(user_agent=USER_AGENT)
    result = fetcher.search(text, category)

    assert isinstance(result.text, str)
Esempio n. 3
0
def test_getting_animu(animu):
    sleep(PAUSE_BETWEEN_REQUESTS)
    fetcher = anidb_parser.AnidbFetcher(user_agent=USER_AGENT)
    client = anidb_parser.AnidbClient(fetcher_instance=fetcher)

    result = client.get_anime(animu)

    assert isinstance(result, anidb_parser.Anime)
Esempio n. 4
0
def test_adult_warning(animu=4544):
    fetcher = anidb_parser.AnidbFetcher(
        user_agent=
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0"
    )
    client = anidb_parser.AnidbClient(fetcher_instance=fetcher)

    with pytest.raises(anidb_parser.exceptions.AdultContentWarning):
        result = client.get_anime(animu)
Esempio n. 5
0
def test_no_results(animu="saMuRai_CHAMPLOO 12412"):
    fetcher = anidb_parser.AnidbFetcher(
        user_agent=
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0"
    )
    client = anidb_parser.AnidbClient(fetcher_instance=fetcher)

    with pytest.raises(anidb_parser.exceptions.NoSearchResults):
        result = client.get_anime(animu)
Esempio n. 6
0
def test_search_fail(text='boku no', category=14124):
    fetcher = anidb_parser.AnidbFetcher(user_agent=USER_AGENT)

    with pytest.raises(AttributeError):
        result = fetcher.search(text, category)
Esempio n. 7
0
def test_adult_warning(animu=4544):
    fetcher = anidb_parser.AnidbFetcher(user_agent=USER_AGENT)
    client = anidb_parser.AnidbClient(fetcher_instance=fetcher)

    with pytest.raises(anidb_parser.exceptions.AdultContentWarning):
        result = client.get_anime(animu)
Esempio n. 8
0
def test_no_results(animu="saMuRai_CHAMPLOO 12412"):
    fetcher = anidb_parser.AnidbFetcher(user_agent=USER_AGENT)
    client = anidb_parser.AnidbClient(fetcher_instance=fetcher)

    with pytest.raises(anidb_parser.exceptions.NoSearchResults):
        result = client.get_anime(animu)