Fix rating mixin tests

This commit is contained in:
JonnyWong16 2021-05-30 16:07:59 -07:00
parent bd8cdb10b7
commit b269140943
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
3 changed files with 9 additions and 2 deletions

View file

@ -6,9 +6,11 @@ def test_mark_movie_watched(movie):
print('Marking movie watched: %s' % movie)
print('View count: %s' % movie.viewCount)
movie.markWatched()
movie.reload()
print('View count: %s' % movie.viewCount)
assert movie.viewCount == 1, 'View count 0 after watched.'
movie.markUnwatched()
movie.reload()
print('View count: %s' % movie.viewCount)
assert movie.viewCount == 0, 'View count 1 after unwatched.'

View file

@ -185,8 +185,9 @@ def edit_rating(obj):
assert utils.is_datetime(obj.lastRatedAt)
assert obj.userRating == 10.0
obj.rate()
obj.reload()
assert obj.lastRatedAt is None
# Cannot use obj.reload() since PlexObject.__setattr__()
# will not overwrite userRating with None
obj = obj.fetchItem(obj._details_key)
assert obj.userRating is None
with pytest.raises(BadRequest):
assert obj.rate('bad-rating')

View file

@ -697,11 +697,13 @@ def test_video_Show_analyze(show):
def test_video_Show_markWatched(show):
show.markWatched()
show.reload()
assert show.isWatched
def test_video_Show_markUnwatched(show):
show.markUnwatched()
show.reload()
assert not show.isWatched
@ -814,12 +816,14 @@ def test_video_Season_show(show):
def test_video_Season_watched(show):
season = show.season("Season 1")
season.markWatched()
season.reload()
assert season.isWatched
def test_video_Season_unwatched(show):
season = show.season("Season 1")
season.markUnwatched()
season.reload()
assert not season.isWatched