Skip to content

Commit

Permalink
tests: add tests for anistream and animefreak
Browse files Browse the repository at this point in the history
  • Loading branch information
vn-ki committed Sep 28, 2019
1 parent ee9a00b commit 8455a79
Show file tree
Hide file tree
Showing 13 changed files with 3,902 additions and 1 deletion.
2 changes: 1 addition & 1 deletion anime_downloader/sites/animefreak.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class AnimeFreak(Anime, sitename='animefreak'):
sitename = 'animefreak'
search_url = f'https://{sitename}.tv/search/topSearch'
search_url = f'https://www.{sitename}.tv/search/topSearch'
anime_url = 'https://www.animefreak.tv/watch'
QUALITIES = ['360p', '480p', '720p', '1080p']

Expand Down
28 changes: 28 additions & 0 deletions tests/test_animefreak.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pytest

from anime_downloader.sites.animefreak import AnimeFreak
from test_sites.site import configure_httpretty


@pytest.fixture
def anime():
return AnimeFreak('https://www.animefreak.tv/watch/shingeki-no-kyojin')

configure_httpretty('animefreak')

def test_search():
ret = AnimeFreak.search('shingeki no kyojin')
assert len(ret) == 24
assert ret[2].title == 'Shingeki no Kyojin'


def test_title(anime):
assert anime.title == ''


def test_length(anime):
assert len(anime) == 28


def test_streamurl(anime):
assert anime[0].source().stream_url == 'http://st7.anime1.com/Attack on Titan s1e01_af.mp4?st=orn45gwkj2zr9NbHogG_YA&e=1569695560'
28 changes: 28 additions & 0 deletions tests/test_anistream.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pytest

from anime_downloader.sites.anistream import Anistream
from test_sites.site import configure_httpretty


@pytest.fixture
def anime():
return Anistream('https://ww5.anistream.xyz/animes/1146-shingeki-no-kyojin')

configure_httpretty('anistream')

def test_search():
ret = Anistream.search('shingeki%20no%20kyojin')
assert len(ret) == 9
assert ret[0].title == 'Shingeki no Kyojin'


def test_title(anime):
assert anime.title == 'Shingeki no Kyojin'


def test_length(anime):
assert len(anime) == 36


def test_streamurl(anime):
assert anime[0].source().stream_url == 'https://mp4.sh/v/45cb7341.mp4?hash=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvbXA0LnNoIiwiYXVkIjoiaHR0cHM6XC9cL21wNC5zaCIsImRhdGEiOnsiaWQiOiI0NWNiNzM0MSIsImlwIjoiMTQuMTM5LjM1LjIzNSJ9LCJpYXQiOjE1Njk2Nzg0MjcsImV4cCI6MTU2OTY3ODQ4N30.dA0wPkLzyJad-ia0v0IkN6YYcguTfKUPUmgNYg7R_oM'
1 change: 1 addition & 0 deletions tests/test_sites/test_animefreak/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"method": "GET", "url": "https://www.animefreak.tv/search/topSearch?q=shingeki+no+kyojin", "file": "tmpyzcvipj6"}, {"method": "GET", "url": "https://www.animefreak.tv/watch/shingeki-no-kyojin", "file": "tmpc_cf80id"}, {"method": "GET", "url": "https://www.animefreak.tv/watch/shingeki-no-kyojin/episode/episode-1", "file": "tmppyea8ln8"}]

0 comments on commit 8455a79

Please sign in to comment.