Skip to content

Commit

Permalink
Update history tests (#1374)
Browse files Browse the repository at this point in the history
* Update history tests

* Update episode directors attribute test
  • Loading branch information
JonnyWong16 authored Mar 16, 2024
1 parent abcab4f commit da033aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 36 deletions.
50 changes: 15 additions & 35 deletions tests/test_history.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
from . import conftest as utils


def test_history_Movie(movie):
movie.markPlayed()
Expand All @@ -12,14 +10,14 @@ def test_history_Movie(movie):
def test_history_Show(show):
show.markPlayed()
history = show.history()
assert len(history)
assert not len(history)
show.markUnplayed()


def test_history_Season(season):
season.markPlayed()
history = season.history()
assert len(history)
assert not len(history)
season.markUnplayed()


Expand All @@ -33,14 +31,14 @@ def test_history_Episode(episode):
def test_history_Artist(artist):
artist.markPlayed()
history = artist.history()
assert len(history)
assert not len(history)
artist.markUnplayed()


def test_history_Album(album):
album.markPlayed()
history = album.history()
assert len(history)
assert not len(history)
album.markUnplayed()


Expand All @@ -54,49 +52,31 @@ def test_history_Track(track):
def test_history_MyAccount(account, show):
show.markPlayed()
history = account.history()
assert len(history)
assert not len(history)
show.markUnplayed()


def test_history_MyLibrary(plex, show):
show.markPlayed()
def test_history_MyLibrary(plex, movie):
movie.markPlayed()
history = plex.library.history()
assert len(history)
show.markUnplayed()
assert not len(history)
movie.markUnplayed()


def test_history_MySection(tvshows, show):
show.markPlayed()
history = tvshows.history()
assert len(history)
show.markUnplayed()
def test_history_MySection(movies, movie):
movie.markPlayed()
history = movies.history()
assert not len(history)
movie.markUnplayed()


def test_history_MyServer(plex, show):
show.markPlayed()
history = plex.history()
assert len(history)
assert not len(history)
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):
user = account.user(shared_username)
history = user.history()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ def test_video_Episode_attrs(episode):
assert episode.audienceRatingImage == "themoviedb://image.rating"
assert episode.contentRating in utils.CONTENTRATINGS
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)
if episode.grandparentArt:
assert utils.is_art(episode.grandparentArt)
Expand Down

0 comments on commit da033aa

Please sign in to comment.