mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 06:04:15 +00:00
Update art and thumb tests
This commit is contained in:
parent
f5cd5277d8
commit
bbafaee1cf
3 changed files with 95 additions and 25 deletions
|
@ -377,10 +377,22 @@ def is_string(value, gte=1):
|
|||
return isinstance(value, str) and len(value) >= gte
|
||||
|
||||
|
||||
def is_art(key):
|
||||
return is_metadata(key, contains="/art/")
|
||||
|
||||
|
||||
def is_thumb(key):
|
||||
return is_metadata(key, contains="/thumb/")
|
||||
|
||||
|
||||
def is_artUrl(url):
|
||||
return url.startswith(SERVER_BASEURL) and "/library/metadata/" in url and "/art/" in url
|
||||
|
||||
|
||||
def is_thumbUrl(url):
|
||||
return url.startswith(SERVER_BASEURL) and "/library/metadata/" in url and "/thumb/" in url
|
||||
|
||||
|
||||
def wait_until(condition_function, delay=0.25, timeout=1, *args, **kwargs):
|
||||
start = time.time()
|
||||
ready = condition_function(*args, **kwargs)
|
||||
|
|
|
@ -8,6 +8,11 @@ from . import test_mixins
|
|||
def test_audio_Artist_attr(artist):
|
||||
artist.reload()
|
||||
assert utils.is_datetime(artist.addedAt)
|
||||
if artist.art:
|
||||
assert utils.is_art(artist.art)
|
||||
assert utils.is_artUrl(artist.artUrl)
|
||||
else:
|
||||
assert artist.artUrl is None
|
||||
if artist.countries:
|
||||
assert "United States of America" in [i.tag for i in artist.countries]
|
||||
#assert "Electronic" in [i.tag for i in artist.genres]
|
||||
|
@ -24,6 +29,11 @@ def test_audio_Artist_attr(artist):
|
|||
assert isinstance(artist.similar, list)
|
||||
if artist.summary:
|
||||
assert "Alias" in artist.summary
|
||||
if artist.thumb:
|
||||
assert utils.is_thumb(artist.thumb)
|
||||
assert utils.is_thumbUrl(artist.thumbUrl)
|
||||
else:
|
||||
assert artist.thumbUrl is None
|
||||
assert artist.title == "Broke For Free"
|
||||
assert artist.titleSort == "Broke For Free"
|
||||
assert artist.type == "artist"
|
||||
|
@ -80,6 +90,11 @@ def test_audio_Artist_mixins_tags(artist):
|
|||
|
||||
def test_audio_Album_attrs(album):
|
||||
assert utils.is_datetime(album.addedAt)
|
||||
if album.art:
|
||||
assert utils.is_art(album.art)
|
||||
assert utils.is_artUrl(album.artUrl)
|
||||
else:
|
||||
assert album.artUrl is None
|
||||
assert isinstance(album.genres, list)
|
||||
assert album.index == 1
|
||||
assert utils.is_metadata(album._initpath)
|
||||
|
@ -90,21 +105,23 @@ def test_audio_Album_attrs(album):
|
|||
assert utils.is_metadata(album.parentKey)
|
||||
assert utils.is_int(album.parentRatingKey)
|
||||
if album.parentThumb:
|
||||
assert utils.is_metadata(album.parentThumb, contains="/thumb/")
|
||||
assert utils.is_thumb(album.parentThumb)
|
||||
assert album.parentTitle == "Broke For Free"
|
||||
assert album.ratingKey >= 1
|
||||
assert album._server._baseurl == utils.SERVER_BASEURL
|
||||
assert album.studio == "[no label]"
|
||||
assert album.summary == ""
|
||||
if album.thumb:
|
||||
assert utils.is_metadata(album.thumb, contains="/thumb/")
|
||||
assert utils.is_thumb(album.thumb)
|
||||
assert utils.is_thumbUrl(album.thumbUrl)
|
||||
else:
|
||||
assert album.thumbUrl is None
|
||||
assert album.title == "Layers"
|
||||
assert album.titleSort == "Layers"
|
||||
assert album.type == "album"
|
||||
assert utils.is_datetime(album.updatedAt)
|
||||
assert utils.is_int(album.viewCount, gte=0)
|
||||
assert album.year in (2012,)
|
||||
assert album.artUrl is None
|
||||
|
||||
|
||||
def test_audio_Album_history(album):
|
||||
|
@ -133,14 +150,14 @@ def test_audio_Album_tracks(album):
|
|||
assert utils.is_metadata(track.parentKey)
|
||||
assert utils.is_int(track.parentRatingKey)
|
||||
if track.parentThumb:
|
||||
assert utils.is_metadata(track.parentThumb, contains="/thumb/")
|
||||
assert utils.is_thumb(track.parentThumb)
|
||||
assert track.parentTitle == "Layers"
|
||||
# assert track.ratingCount == 9 # Flaky
|
||||
assert utils.is_int(track.ratingKey)
|
||||
assert track._server._baseurl == utils.SERVER_BASEURL
|
||||
assert track.summary == ""
|
||||
if track.thumb:
|
||||
assert utils.is_metadata(track.thumb, contains="/thumb/")
|
||||
assert utils.is_thumb(track.thumb)
|
||||
assert track.title == "As Colourful as Ever"
|
||||
assert track.titleSort == "As Colourful as Ever"
|
||||
assert not track.transcodeSessions
|
||||
|
@ -156,6 +173,11 @@ def test_audio_Album_track(album, track=None):
|
|||
track2 = album.track(track=1)
|
||||
assert track == track2
|
||||
assert utils.is_datetime(track.addedAt)
|
||||
if track.art:
|
||||
assert utils.is_art(track.art)
|
||||
assert utils.is_artUrl(track.artUrl)
|
||||
else:
|
||||
assert track.artUrl is None
|
||||
assert utils.is_int(track.duration)
|
||||
assert utils.is_metadata(track.grandparentKey)
|
||||
assert utils.is_int(track.grandparentRatingKey)
|
||||
|
@ -172,14 +194,17 @@ def test_audio_Album_track(album, track=None):
|
|||
assert utils.is_metadata(track.parentKey)
|
||||
assert utils.is_int(track.parentRatingKey)
|
||||
if track.parentThumb:
|
||||
assert utils.is_metadata(track.parentThumb, contains="/thumb/")
|
||||
assert utils.is_thumb(track.parentThumb)
|
||||
assert track.parentTitle == "Layers"
|
||||
# assert track.ratingCount == 9
|
||||
assert utils.is_int(track.ratingKey)
|
||||
assert track._server._baseurl == utils.SERVER_BASEURL
|
||||
assert track.summary == ""
|
||||
if track.thumb:
|
||||
assert utils.is_metadata(track.thumb, contains="/thumb/")
|
||||
assert utils.is_thumb(track.thumb)
|
||||
assert utils.is_thumbUrl(track.thumbUrl)
|
||||
else:
|
||||
assert track.thumbUrl is None
|
||||
assert track.title == "As Colourful as Ever"
|
||||
assert track.titleSort == "As Colourful as Ever"
|
||||
assert not track.transcodeSessions
|
||||
|
@ -212,7 +237,6 @@ def test_audio_Album_track(album, track=None):
|
|||
assert utils.is_part(part.key)
|
||||
assert part._server._baseurl == utils.SERVER_BASEURL
|
||||
assert part.size == 3761053
|
||||
assert track.artUrl is None
|
||||
|
||||
|
||||
def test_audio_Album_get(album):
|
||||
|
@ -242,14 +266,18 @@ def test_audio_Album_mixins_tags(album):
|
|||
def test_audio_Track_attrs(album):
|
||||
track = album.get("As Colourful As Ever").reload()
|
||||
assert utils.is_datetime(track.addedAt)
|
||||
assert track.art is None
|
||||
if track.art:
|
||||
assert utils.is_art(track.art)
|
||||
assert utils.is_artUrl(track.artUrl)
|
||||
else:
|
||||
assert track.artUrl is None
|
||||
assert track.chapterSource is None
|
||||
assert utils.is_int(track.duration)
|
||||
assert track.grandparentArt is None
|
||||
assert utils.is_metadata(track.grandparentKey)
|
||||
assert utils.is_int(track.grandparentRatingKey)
|
||||
if track.grandparentThumb:
|
||||
assert utils.is_metadata(track.grandparentThumb, contains="/thumb/")
|
||||
assert utils.is_thumb(track.grandparentThumb)
|
||||
assert track.grandparentTitle == "Broke For Free"
|
||||
assert track.guid.startswith("mbid://") or track.guid.startswith("plex://track/")
|
||||
assert int(track.index) == 1
|
||||
|
@ -268,7 +296,7 @@ def test_audio_Track_attrs(album):
|
|||
assert utils.is_metadata(track.parentKey)
|
||||
assert utils.is_int(track.parentRatingKey)
|
||||
if track.parentThumb:
|
||||
assert utils.is_metadata(track.parentThumb, contains="/thumb/")
|
||||
assert utils.is_thumb(track.parentThumb)
|
||||
assert track.parentTitle == "Layers"
|
||||
assert track.playlistItemID is None
|
||||
assert track.primaryExtraKey is None
|
||||
|
@ -278,7 +306,10 @@ def test_audio_Track_attrs(album):
|
|||
assert track.sessionKey is None
|
||||
assert track.summary == ""
|
||||
if track.thumb:
|
||||
assert utils.is_metadata(track.thumb, contains="/thumb/")
|
||||
assert utils.is_thumb(track.thumb)
|
||||
assert utils.is_thumbUrl(track.thumbUrl)
|
||||
else:
|
||||
assert track.thumbUrl is None
|
||||
assert track.title == "As Colourful as Ever"
|
||||
assert track.titleSort == "As Colourful as Ever"
|
||||
assert not track.transcodeSessions
|
||||
|
|
|
@ -157,8 +157,11 @@ def test_video_Movie_attrs(movies):
|
|||
assert len(movie.locations) == 1
|
||||
assert len(movie.locations[0]) >= 10
|
||||
assert utils.is_datetime(movie.addedAt)
|
||||
assert utils.is_metadata(movie.art)
|
||||
assert movie.artUrl
|
||||
if movie.art:
|
||||
assert utils.is_art(movie.art)
|
||||
assert utils.is_artUrl(movie.artUrl)
|
||||
else:
|
||||
assert movie.artUrl is None
|
||||
assert float(movie.rating) >= 6.4
|
||||
assert movie.ratingImage == 'rottentomatoes://image.rating.ripe'
|
||||
assert movie.audienceRating >= 8.5
|
||||
|
@ -199,7 +202,11 @@ def test_video_Movie_attrs(movies):
|
|||
assert movie.studio == "Nina Paley"
|
||||
assert utils.is_string(movie.summary, gte=100)
|
||||
assert movie.tagline == "The Greatest Break-Up Story Ever Told"
|
||||
assert utils.is_thumb(movie.thumb)
|
||||
if movie.thumb:
|
||||
assert utils.is_thumb(movie.thumb)
|
||||
assert utils.is_thumbUrl(movie.thumbUrl)
|
||||
else:
|
||||
assert movie.thumbUrl is None
|
||||
assert movie.title == "Sita Sings the Blues"
|
||||
assert movie.titleSort == "Sita Sings the Blues"
|
||||
assert not movie.transcodeSessions
|
||||
|
@ -547,7 +554,11 @@ def test_video_Episode_stop(episode, mocker, patched_http_call):
|
|||
|
||||
def test_video_Show_attrs(show):
|
||||
assert utils.is_datetime(show.addedAt)
|
||||
assert utils.is_metadata(show.art, contains="/art/")
|
||||
if show.art:
|
||||
assert utils.is_art(show.art)
|
||||
assert utils.is_artUrl(show.artUrl)
|
||||
else:
|
||||
assert show.artUrl is None
|
||||
assert utils.is_metadata(show.banner, contains="/banner/")
|
||||
assert utils.is_int(show.childCount)
|
||||
assert show.contentRating in utils.CONTENTRATINGS
|
||||
|
@ -586,7 +597,11 @@ def test_video_Show_attrs(show):
|
|||
assert show.studio == "HBO"
|
||||
assert utils.is_string(show.summary, gte=100)
|
||||
assert utils.is_metadata(show.theme, contains="/theme/")
|
||||
assert utils.is_metadata(show.thumb, contains="/thumb/")
|
||||
if show.thumb:
|
||||
assert utils.is_thumb(show.thumb)
|
||||
assert utils.is_thumbUrl(show.thumbUrl)
|
||||
else:
|
||||
assert show.thumbUrl is None
|
||||
assert show.title == "Game of Thrones"
|
||||
assert show.titleSort == "Game of Thrones"
|
||||
assert show.type == "show"
|
||||
|
@ -681,12 +696,6 @@ def test_video_Episode_download(monkeydownload, tmpdir, episode):
|
|||
assert len(with_sceen_size) == 1
|
||||
|
||||
|
||||
def test_video_Show_thumbUrl(show):
|
||||
assert utils.SERVER_BASEURL in show.thumbUrl
|
||||
assert "/library/metadata/" in show.thumbUrl
|
||||
assert "/thumb/" in show.thumbUrl
|
||||
|
||||
|
||||
# Analyze seems to fail intermittently
|
||||
@pytest.mark.xfail
|
||||
def test_video_Show_analyze(show):
|
||||
|
@ -782,6 +791,11 @@ def test_video_Episode_analyze(tvshows):
|
|||
|
||||
def test_video_Episode_attrs(episode):
|
||||
assert utils.is_datetime(episode.addedAt)
|
||||
if episode.art:
|
||||
assert utils.is_art(episode.art)
|
||||
assert utils.is_artUrl(episode.artUrl)
|
||||
else:
|
||||
assert episode.artUrl is None
|
||||
assert episode.contentRating in utils.CONTENTRATINGS
|
||||
if len(episode.directors):
|
||||
assert [i.tag for i in episode.directors] == ["Tim Van Patten"]
|
||||
|
@ -801,7 +815,11 @@ def test_video_Episode_attrs(episode):
|
|||
assert episode._server._baseurl == utils.SERVER_BASEURL
|
||||
assert episode.skipParent is False
|
||||
assert utils.is_string(episode.summary, gte=100)
|
||||
assert utils.is_metadata(episode.thumb, contains="/thumb/")
|
||||
if episode.thumb:
|
||||
assert utils.is_thumb(episode.thumb)
|
||||
assert utils.is_thumbUrl(episode.thumbUrl)
|
||||
else:
|
||||
assert episode.thumbUrl is None
|
||||
assert episode.title == "Winter Is Coming"
|
||||
assert episode.titleSort == "Winter Is Coming"
|
||||
assert not episode.transcodeSessions
|
||||
|
@ -876,6 +894,11 @@ def test_video_Season_history(show):
|
|||
def test_video_Season_attrs(show):
|
||||
season = show.season("Season 1")
|
||||
assert utils.is_datetime(season.addedAt)
|
||||
if season.art:
|
||||
assert utils.is_art(season.art)
|
||||
assert utils.is_artUrl(season.artUrl)
|
||||
else:
|
||||
assert season.artUrl is None
|
||||
assert season.index == 1
|
||||
assert utils.is_metadata(season._initpath)
|
||||
assert utils.is_metadata(season.key)
|
||||
|
@ -888,7 +911,11 @@ def test_video_Season_attrs(show):
|
|||
assert utils.is_int(season.ratingKey)
|
||||
assert season._server._baseurl == utils.SERVER_BASEURL
|
||||
assert season.summary == ""
|
||||
assert utils.is_metadata(season.thumb, contains="/thumb/")
|
||||
if season.thumb:
|
||||
assert utils.is_thumb(season.thumb)
|
||||
assert utils.is_thumbUrl(season.thumbUrl)
|
||||
else:
|
||||
assert season.thumbUrl is None
|
||||
assert season.title == "Season 1"
|
||||
assert season.titleSort == "Season 1"
|
||||
assert season.type == "season"
|
||||
|
|
Loading…
Reference in a new issue