2018-06-11 09:10:59 -07:00
|
|
|
from anime_downloader import get_anime_class
|
2018-05-30 03:56:27 -07:00
|
|
|
from anime_downloader.sites.nineanime import NineAnime
|
2018-05-27 11:59:51 -07:00
|
|
|
|
|
|
|
import pytest
|
2018-07-13 04:57:08 -07:00
|
|
|
import os
|
2018-05-30 03:56:27 -07:00
|
|
|
|
2018-05-27 11:59:51 -07:00
|
|
|
@pytest.fixture
|
2018-06-11 09:10:59 -07:00
|
|
|
def anime(anime_url):
|
|
|
|
cls = get_anime_class(anime_url)
|
|
|
|
|
|
|
|
return cls(
|
2018-06-19 12:04:53 -07:00
|
|
|
anime_url, quality='480p'
|
2018-05-27 12:34:47 -07:00
|
|
|
)
|
2018-05-27 11:59:51 -07:00
|
|
|
|
|
|
|
|
|
|
|
def test_length(anime):
|
|
|
|
assert len(anime) == 12
|
|
|
|
|
|
|
|
|
|
|
|
def test_title(anime):
|
2018-06-11 10:04:01 -07:00
|
|
|
assert anime.title.lower() in ['kochinpa!', 'kochin pa!']
|
2018-05-27 11:59:51 -07:00
|
|
|
|
|
|
|
|
2018-07-13 04:57:08 -07:00
|
|
|
@pytest.mark.skipif(bool(os.environ.get('CI')), reason="Test fails on ci")
|
|
|
|
def test_episode(anime):
|
|
|
|
episode1 = anime[0]
|
|
|
|
assert episode1.stream_url.endswith('.mp4')
|
2018-05-27 12:15:35 -07:00
|
|
|
|
|
|
|
|
2018-07-13 04:57:08 -07:00
|
|
|
@pytest.mark.skipif(bool(os.environ.get('CI')), reason="Test fails on ci")
|
|
|
|
def test_download(anime, tmpdir):
|
|
|
|
eps = (anime[0], anime[6], anime[-1])
|
|
|
|
for ep in eps:
|
|
|
|
ep.download(path=str(tmpdir))
|
2018-05-28 12:38:55 -07:00
|
|
|
|
|
|
|
|
|
|
|
def test_search():
|
|
|
|
results = NineAnime.search('dragon ball super')
|
|
|
|
|
|
|
|
assert len(results) == 30
|
2018-07-27 11:54:53 -07:00
|
|
|
assert results[0].title.lower() in ['dragon ball super', 'dragon ball super movie']
|