[tests] Speed up tests
This commit is contained in:
@ -64,7 +64,10 @@ def mopidy_scrobble_media(post_data: dict, user_id: int) -> Scrobble:
|
||||
if media_type == Scrobble.MediaType.PODCAST_EPISODE:
|
||||
parsed_data = parse_mopidy_uri(post_data.get("mopidy_uri", ""))
|
||||
if not parsed_data:
|
||||
logger.warning("Tried to scrobble podcast but no uri found", extra={"post_data": post_data})
|
||||
logger.warning(
|
||||
"Tried to scrobble podcast but no uri found",
|
||||
extra={"post_data": post_data},
|
||||
)
|
||||
return Scrobble()
|
||||
|
||||
media_obj = PodcastEpisode.find_or_create(**parsed_data)
|
||||
@ -167,7 +170,10 @@ def web_scrobbler_scrobble_media(
|
||||
|
||||
|
||||
def manual_scrobble_video(
|
||||
video_id: str, user_id: int, source: str = "IMDb", action: Optional[str] = None
|
||||
video_id: str,
|
||||
user_id: int,
|
||||
source: str = "IMDb",
|
||||
action: Optional[str] = None,
|
||||
):
|
||||
video = Video.find_or_create(video_id)
|
||||
|
||||
@ -200,7 +206,10 @@ def manual_scrobble_video(
|
||||
|
||||
|
||||
def manual_scrobble_event(
|
||||
thesportsdb_id: str, user_id: int, source: str = "TheSportsDB", action: Optional[str] = None
|
||||
thesportsdb_id: str,
|
||||
user_id: int,
|
||||
source: str = "TheSportsDB",
|
||||
action: Optional[str] = None,
|
||||
):
|
||||
data_dict = lookup_event_from_thesportsdb(thesportsdb_id)
|
||||
|
||||
@ -215,7 +224,10 @@ def manual_scrobble_event(
|
||||
|
||||
|
||||
def manual_scrobble_video_game(
|
||||
hltb_id: str, user_id: int, source: str = "HLTB", action: Optional[str] = None
|
||||
hltb_id: str,
|
||||
user_id: int,
|
||||
source: str = "HLTB",
|
||||
action: Optional[str] = None,
|
||||
):
|
||||
game = VideoGame.objects.filter(hltb_id=hltb_id).first()
|
||||
if not game:
|
||||
@ -255,7 +267,10 @@ def manual_scrobble_video_game(
|
||||
|
||||
|
||||
def manual_scrobble_book(
|
||||
title: str, user_id: int, source: str = "Google Books", action: Optional[str] = None
|
||||
title: str,
|
||||
user_id: int,
|
||||
source: str = "Google Books",
|
||||
action: Optional[str] = None,
|
||||
):
|
||||
log = {}
|
||||
page = None
|
||||
@ -280,7 +295,9 @@ def manual_scrobble_book(
|
||||
if not page:
|
||||
page = 1
|
||||
|
||||
logger.info("[scrobblers] Book page included in scrobble, should update!")
|
||||
logger.info(
|
||||
"[scrobblers] Book page included in scrobble, should update!"
|
||||
)
|
||||
|
||||
source = READCOMICSONLINE_URL.replace("https://", "")
|
||||
|
||||
@ -306,8 +323,9 @@ def manual_scrobble_book(
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
scrobble = Scrobble.create_or_update(book, user_id, scrobble_dict, read_log_page=page)
|
||||
scrobble = Scrobble.create_or_update(
|
||||
book, user_id, scrobble_dict, read_log_page=page
|
||||
)
|
||||
|
||||
if action == "stop":
|
||||
if url:
|
||||
@ -322,7 +340,10 @@ def manual_scrobble_book(
|
||||
|
||||
|
||||
def manual_scrobble_board_game(
|
||||
bggeek_id: str, user_id: int, source: str = "BGG", action: Optional[str] = None
|
||||
bggeek_id: str,
|
||||
user_id: int,
|
||||
source: str = "BGG",
|
||||
action: Optional[str] = None,
|
||||
) -> Scrobble | None:
|
||||
boardgame = BoardGame.find_or_create(bggeek_id)
|
||||
|
||||
@ -524,7 +545,10 @@ def email_scrobble_board_game(
|
||||
|
||||
|
||||
def manual_scrobble_from_url(
|
||||
url: str, user_id: int, source: str = "Vrobbler", action: Optional[str] = None
|
||||
url: str,
|
||||
user_id: int,
|
||||
source: str = "Vrobbler",
|
||||
action: Optional[str] = None,
|
||||
) -> Scrobble:
|
||||
"""We have scrobblable media URLs, and then any other webpages that
|
||||
we want to scrobble as a media type in and of itself. This checks whether
|
||||
@ -840,7 +864,12 @@ def emacs_scrobble_task(
|
||||
return scrobble
|
||||
|
||||
|
||||
def manual_scrobble_task(url: str, user_id: int, source: str = "Vrobbler", action: Optional[str] = None):
|
||||
def manual_scrobble_task(
|
||||
url: str,
|
||||
user_id: int,
|
||||
source: str = "Vrobbler",
|
||||
action: Optional[str] = None,
|
||||
):
|
||||
source_id = re.findall(r"\d+", url)[0]
|
||||
|
||||
description = ""
|
||||
@ -872,7 +901,10 @@ def manual_scrobble_task(url: str, user_id: int, source: str = "Vrobbler", actio
|
||||
|
||||
|
||||
def manual_scrobble_webpage(
|
||||
url: str, user_id: int, source: str = "Bookmarklet", action: Optional[str] = None
|
||||
url: str,
|
||||
user_id: int,
|
||||
source: str = "Bookmarklet",
|
||||
action: Optional[str] = None,
|
||||
):
|
||||
webpage = WebPage.find_or_create({"url": url})
|
||||
|
||||
@ -999,7 +1031,10 @@ def web_scrobbler_scrobble_video_or_song(
|
||||
|
||||
|
||||
def manual_scrobble_beer(
|
||||
untappd_id: str, user_id: int, source: str = "Untappd", action: Optional[str] = None
|
||||
untappd_id: str,
|
||||
user_id: int,
|
||||
source: str = "Untappd",
|
||||
action: Optional[str] = None,
|
||||
):
|
||||
beer = Beer.find_or_create(untappd_id)
|
||||
|
||||
@ -1028,7 +1063,10 @@ def manual_scrobble_beer(
|
||||
|
||||
|
||||
def manual_scrobble_puzzle(
|
||||
ipdb_id: str, user_id: int, source: str = "IPDb", action: Optional[str] = None
|
||||
ipdb_id: str,
|
||||
user_id: int,
|
||||
source: str = "IPDb",
|
||||
action: Optional[str] = None,
|
||||
):
|
||||
puzzle = Puzzle.find_or_create(ipdb_id)
|
||||
|
||||
@ -1057,7 +1095,10 @@ def manual_scrobble_puzzle(
|
||||
|
||||
|
||||
def manual_scrobble_brickset(
|
||||
brickset_id: str, user_id: int, source: str = "BrickSet", action: Optional[str] = None
|
||||
brickset_id: str,
|
||||
user_id: int,
|
||||
source: str = "BrickSet",
|
||||
action: Optional[str] = None,
|
||||
):
|
||||
brickset = BrickSet.find_or_create(brickset_id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user