Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update history tests #1374

Merged
merged 2 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading