Tests now pass for both test servers

This commit is contained in:
Michael Shepanski 2017-04-23 01:54:53 -04:00
parent 7ec909dce6
commit 379b8ff63b
5 changed files with 23 additions and 16 deletions

View file

@ -112,7 +112,10 @@ def episode(show):
@pytest.fixture()
def photoalbum(photos):
try:
return photos.get('Cats')
except:
return photos.get('photo_album1')
@pytest.fixture()

View file

@ -63,6 +63,7 @@ def test_audio_Album_attrs(album):
assert album.originallyAvailableAt == datetime(2016, 1, 1)
assert utils.is_metadata(album.parentKey)
assert utils.is_int(album.parentRatingKey)
if album.parentThumb:
assert utils.is_metadata(album.parentThumb, contains='/thumb/')
assert album.parentTitle == 'Infinite State'
assert album.ratingKey >= 1
@ -192,6 +193,7 @@ def test_audio_Track_attrs(album):
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 track.grandparentTitle == 'Infinite State'
assert track.guid.startswith('local://')

View file

@ -168,14 +168,15 @@ def test_library_MusicSection_searchAlbums(music):
assert len(music.searchAlbums(title='Unmastered Impulses'))
def test_library_PhotoSection_searchAlbums(photos):
albums = photos.searchAlbums('Cats')
def test_library_PhotoSection_searchAlbums(photos, photoalbum):
title = photoalbum.title
albums = photos.searchAlbums(title)
assert len(albums)
print([i.TYPE for i in albums])
def test_library_PhotoSection_searchPhotos(photos):
assert len(photos.searchPhotos('CatBed'))
def test_library_PhotoSection_searchPhotos(photos, photoalbum):
title = photoalbum.photos()[0].title
assert len(photos.searchPhotos(title))
# Start on library search

View file

@ -102,12 +102,12 @@ def test_server_playlist(plex, show):
def test_server_playlists(plex, show):
playlists = plex.playlists()
assert len(playlists) == 0
count = len(playlists)
episodes = show.episodes()
playlist = plex.createPlaylist('test_playlist', episodes[:3])
try:
playlists = plex.playlists()
assert len(playlists) == 1
assert len(playlists) == count + 1
finally:
playlist.delete()

View file

@ -66,15 +66,16 @@ def test_video_Movie_attrs(movies):
assert movie.chapterSource == 'agent'
assert movie.collections == []
assert movie.contentRating == 'G'
assert [i.tag for i in movie.countries] == ['USA']
assert all([i.tag in ['US', 'USA'] for i in movie.countries])
assert [i.tag for i in movie.directors] == ['John Lasseter', 'Joe Ranft']
assert movie.duration >= 3600000
assert movie.duration >= 160000
assert movie.fields == []
assert sorted([i.tag for i in movie.genres]) == ['Adventure', 'Animation', 'Comedy', 'Family', 'Sport']
assert movie.guid == 'com.plexapp.agents.imdb://tt0317219?lang=en'
assert utils.is_metadata(movie._initpath)
assert utils.is_metadata(movie.key)
assert movie.lastViewedAt is None
if movie.lastViewedAt:
assert utils.is_datetime(movie.lastViewedAt)
assert int(movie.librarySectionID) >= 1
assert movie.listType == 'video'
assert movie.originalTitle is None
@ -101,7 +102,7 @@ def test_video_Movie_attrs(movies):
assert movie.userRating is None
assert movie.username is None
assert movie.viewCount == 0
assert movie.viewOffset == 0
assert utils.is_int(movie.viewOffset, gte=0)
assert movie.viewedAt is None
assert sorted([i.tag for i in movie.writers]) == ['Dan Fogelman', 'Joe Ranft', 'John Lasseter', 'Jorgen Klubien', 'Kiel Murray', 'Phil Lorin'] # noqa
assert movie.year == 2006
@ -134,7 +135,7 @@ def test_video_Movie_attrs(movies):
assert media.audioCodec in utils.CODECS
assert utils.is_int(media.bitrate)
assert media.container in utils.CONTAINERS
assert utils.is_int(media.duration, gte=3600000)
assert utils.is_int(media.duration, gte=160000)
assert utils.is_int(media.height)
assert utils.is_int(media.id)
assert utils.is_metadata(media._initpath)
@ -176,7 +177,7 @@ def test_video_Movie_attrs(movies):
# Part
part = media.parts[0]
assert part.container in utils.CONTAINERS
assert utils.is_int(part.duration, 1600000)
assert utils.is_int(part.duration, 160000)
assert len(part.file) >= 10
assert utils.is_int(part.id)
assert utils.is_metadata(part._initpath)