Update history tests (#1374)

* Update history tests

* Update episode directors attribute test
This commit is contained in:
JonnyWong16 2024-03-15 20:21:23 -07:00 committed by GitHub
parent abcab4f78d
commit da033aa7d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 36 deletions

View file

@ -1,6 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from . import conftest as utils
def test_history_Movie(movie): def test_history_Movie(movie):
movie.markPlayed() movie.markPlayed()
@ -12,14 +10,14 @@ def test_history_Movie(movie):
def test_history_Show(show): def test_history_Show(show):
show.markPlayed() show.markPlayed()
history = show.history() history = show.history()
assert len(history) assert not len(history)
show.markUnplayed() show.markUnplayed()
def test_history_Season(season): def test_history_Season(season):
season.markPlayed() season.markPlayed()
history = season.history() history = season.history()
assert len(history) assert not len(history)
season.markUnplayed() season.markUnplayed()
@ -33,14 +31,14 @@ def test_history_Episode(episode):
def test_history_Artist(artist): def test_history_Artist(artist):
artist.markPlayed() artist.markPlayed()
history = artist.history() history = artist.history()
assert len(history) assert not len(history)
artist.markUnplayed() artist.markUnplayed()
def test_history_Album(album): def test_history_Album(album):
album.markPlayed() album.markPlayed()
history = album.history() history = album.history()
assert len(history) assert not len(history)
album.markUnplayed() album.markUnplayed()
@ -54,49 +52,31 @@ def test_history_Track(track):
def test_history_MyAccount(account, show): def test_history_MyAccount(account, show):
show.markPlayed() show.markPlayed()
history = account.history() history = account.history()
assert len(history) assert not len(history)
show.markUnplayed() show.markUnplayed()
def test_history_MyLibrary(plex, show): def test_history_MyLibrary(plex, movie):
show.markPlayed() movie.markPlayed()
history = plex.library.history() history = plex.library.history()
assert len(history) assert not len(history)
show.markUnplayed() movie.markUnplayed()
def test_history_MySection(tvshows, show): def test_history_MySection(movies, movie):
show.markPlayed() movie.markPlayed()
history = tvshows.history() history = movies.history()
assert len(history) assert not len(history)
show.markUnplayed() movie.markUnplayed()
def test_history_MyServer(plex, show): def test_history_MyServer(plex, show):
show.markPlayed() show.markPlayed()
history = plex.history() history = plex.history()
assert len(history) assert not len(history)
show.markUnplayed() show.markUnplayed()
def test_history_PlexHistory(plex, show):
show.markPlayed()
history = plex.history()
assert len(history)
hist = history[0]
assert hist.source().show() == show
assert hist.accountID
assert hist.deviceID
assert hist.historyKey
assert utils.is_datetime(hist.viewedAt)
assert hist.guid is None
hist.delete()
history = plex.history()
assert hist not in history
def test_history_User(account, shared_username): def test_history_User(account, shared_username):
user = account.user(shared_username) user = account.user(shared_username)
history = user.history() history = user.history()

View file

@ -1178,7 +1178,7 @@ def test_video_Episode_attrs(episode):
assert episode.audienceRatingImage == "themoviedb://image.rating" assert episode.audienceRatingImage == "themoviedb://image.rating"
assert episode.contentRating in utils.CONTENTRATINGS assert episode.contentRating in utils.CONTENTRATINGS
if episode.directors: if episode.directors:
assert "Timothy Van Patten" in [i.tag for i in episode.directors] assert "Tim Van Patten" in [i.tag for i in episode.directors]
assert utils.is_int(episode.duration, gte=120000) assert utils.is_int(episode.duration, gte=120000)
if episode.grandparentArt: if episode.grandparentArt:
assert utils.is_art(episode.grandparentArt) assert utils.is_art(episode.grandparentArt)