Skip to content

Commit b269140

Browse files
committed
Fix rating mixin tests
1 parent bd8cdb1 commit b269140

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

tests/test_actions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ def test_mark_movie_watched(movie):
66
print('Marking movie watched: %s' % movie)
77
print('View count: %s' % movie.viewCount)
88
movie.markWatched()
9+
movie.reload()
910
print('View count: %s' % movie.viewCount)
1011
assert movie.viewCount == 1, 'View count 0 after watched.'
1112
movie.markUnwatched()
13+
movie.reload()
1214
print('View count: %s' % movie.viewCount)
1315
assert movie.viewCount == 0, 'View count 1 after unwatched.'
1416

tests/test_mixins.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,9 @@ def edit_rating(obj):
185185
assert utils.is_datetime(obj.lastRatedAt)
186186
assert obj.userRating == 10.0
187187
obj.rate()
188-
obj.reload()
189-
assert obj.lastRatedAt is None
188+
# Cannot use obj.reload() since PlexObject.__setattr__()
189+
# will not overwrite userRating with None
190+
obj = obj.fetchItem(obj._details_key)
190191
assert obj.userRating is None
191192
with pytest.raises(BadRequest):
192193
assert obj.rate('bad-rating')

tests/test_video.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,11 +697,13 @@ def test_video_Show_analyze(show):
697697

698698
def test_video_Show_markWatched(show):
699699
show.markWatched()
700+
show.reload()
700701
assert show.isWatched
701702

702703

703704
def test_video_Show_markUnwatched(show):
704705
show.markUnwatched()
706+
show.reload()
705707
assert not show.isWatched
706708

707709

@@ -814,12 +816,14 @@ def test_video_Season_show(show):
814816
def test_video_Season_watched(show):
815817
season = show.season("Season 1")
816818
season.markWatched()
819+
season.reload()
817820
assert season.isWatched
818821

819822

820823
def test_video_Season_unwatched(show):
821824
season = show.season("Season 1")
822825
season.markUnwatched()
826+
season.reload()
823827
assert not season.isWatched
824828

825829

0 commit comments

Comments
 (0)