136 lines
4.7 KiB
Python
136 lines
4.7 KiB
Python
# flake8: noqa: E501
|
|
from datetime import datetime, timedelta
|
|
|
|
from pynyaata.bridge.animeultime import AnimeUltime
|
|
from pynyaata.types import RemoteFile
|
|
|
|
from pytest import mark
|
|
|
|
|
|
def test_search_url():
|
|
previous_month = datetime.now() - timedelta(days=30)
|
|
|
|
assert (
|
|
AnimeUltime().search_url()
|
|
== f"http://www.anime-ultime.net/history-0-1/{datetime.now().strftime('%m%Y')}"
|
|
)
|
|
|
|
assert (
|
|
AnimeUltime().search_url("", 2)
|
|
== f"http://www.anime-ultime.net/history-0-1/{previous_month.strftime('%m%Y')}"
|
|
)
|
|
|
|
assert (
|
|
AnimeUltime().search_url("test", 1) == "http://www.anime-ultime.net/search-0-1/"
|
|
)
|
|
|
|
assert (
|
|
AnimeUltime().search_url("test", 2) == "http://www.anime-ultime.net/search-0-1/"
|
|
)
|
|
|
|
|
|
@mark.asyncio
|
|
async def test_search():
|
|
remotes = [
|
|
RemoteFile(
|
|
bridge="AnimeUltime",
|
|
id=4631,
|
|
category="OAV",
|
|
name="Akuma no Riddle: Shousha wa Dare? Nukiuchi Test",
|
|
link="http://www.anime-ultime.net/file-0-1/4631-Akuma-no-Riddle-Shousha-wa-Dare-Nukiuchi-Test",
|
|
),
|
|
RemoteFile(
|
|
bridge="AnimeUltime",
|
|
id=4250,
|
|
category="OAV",
|
|
name="Baka to Test to shoukanjuu (spécial Noël)",
|
|
link="http://www.anime-ultime.net/file-0-1/4250-Baka-to-Test-to-shoukanjuu-special-Noel",
|
|
),
|
|
RemoteFile(
|
|
bridge="AnimeUltime",
|
|
id=3057,
|
|
category="OAV",
|
|
name="Baka to Test to shoukanjuu (spéciaux)",
|
|
link="http://www.anime-ultime.net/file-0-1/3057-Baka-to-Test-to-shoukanjuu-speciaux",
|
|
),
|
|
RemoteFile(
|
|
bridge="AnimeUltime",
|
|
id=5453,
|
|
category="OAV",
|
|
name="Baka to Test to Shoukanjuu Mini Anime",
|
|
link="http://www.anime-ultime.net/file-0-1/5453-Baka-to-Test-to-Shoukanjuu-Mini-Anime",
|
|
),
|
|
RemoteFile(
|
|
bridge="AnimeUltime",
|
|
id=2458,
|
|
category="Episode",
|
|
name="Baka to Test to shoukanjuu ni! [Saison 2]",
|
|
link="http://www.anime-ultime.net/file-0-1/2458-Baka-to-Test-to-shoukanjuu-ni-Saison-2",
|
|
),
|
|
RemoteFile(
|
|
bridge="AnimeUltime",
|
|
id=1887,
|
|
category="Episode",
|
|
name="Baka to Test to shoukanjuu [Saison 1]",
|
|
link="http://www.anime-ultime.net/file-0-1/1887-Baka-to-Test-to-shoukanjuu-Saison-1",
|
|
),
|
|
RemoteFile(
|
|
bridge="AnimeUltime",
|
|
id=2320,
|
|
category="OAV",
|
|
name="Baka to Test to Shoukanjuu: Matsuri",
|
|
link="http://www.anime-ultime.net/file-0-1/2320-Baka-to-Test-to-Shoukanjuu-Matsuri",
|
|
),
|
|
RemoteFile(
|
|
bridge="AnimeUltime",
|
|
id=4463,
|
|
category="OAV",
|
|
name="Baka to Test to Shoukanjuu: Spinout! Sore ga Bokura no Nichijou",
|
|
link="http://www.anime-ultime.net/file-0-1/4463-Baka-to-Test-to-Shoukanjuu-Spinout-Sore-ga-Bokura-no-Nichijou",
|
|
),
|
|
RemoteFile(
|
|
bridge="AnimeUltime",
|
|
id=5069,
|
|
category="OAV",
|
|
name="Shinmai Maou no Testament Burst OAV [Interdit -16 ans]",
|
|
link="http://www.anime-ultime.net/file-0-1/5069-Shinmai-Maou-no-Testament-Burst-OAV-Interdit--16-ans",
|
|
),
|
|
RemoteFile(
|
|
bridge="AnimeUltime",
|
|
id=5487,
|
|
category="OAV",
|
|
name="Shinmai Maou no Testament Departures [Interdit -16 ans]",
|
|
link="http://www.anime-ultime.net/file-0-1/5487-Shinmai-Maou-no-Testament-Departures-Interdit--16-ans",
|
|
),
|
|
RemoteFile(
|
|
bridge="AnimeUltime",
|
|
id=4830,
|
|
category="OAV",
|
|
name="Shinmai Maou no Testament OAD [Interdit -16 ans]",
|
|
link="http://www.anime-ultime.net/file-0-1/4830-Shinmai-Maou-no-Testament-OAD-Interdit--16-ans",
|
|
),
|
|
RemoteFile(
|
|
bridge="AnimeUltime",
|
|
id=3449,
|
|
category="Film",
|
|
name="Robot Contest [J-Film]",
|
|
link="http://www.anime-ultime.net/file-0-1/3449-Robot-Contest-J-Film",
|
|
),
|
|
RemoteFile(
|
|
bridge="AnimeUltime",
|
|
id=2879,
|
|
category="OST",
|
|
name="Baka to Test to shoukanjuu ni! [Saison 2]",
|
|
link="http://www.anime-ultime.net/file-0-1/2879-Baka-to-Test-to-shoukanjuu-ni-Saison-2",
|
|
),
|
|
RemoteFile(
|
|
bridge="AnimeUltime",
|
|
id=1926,
|
|
category="OST",
|
|
name="Baka to Test to shoukanjuu [Saison 1]",
|
|
link="http://www.anime-ultime.net/file-0-1/1926-Baka-to-Test-to-shoukanjuu-Saison-1",
|
|
),
|
|
]
|
|
|
|
assert await AnimeUltime().search("test") == remotes
|