Fix private variable names in tests

This commit is contained in:
Michael Shepanski 2017-02-07 02:14:49 -05:00
parent c072347593
commit fcc1248a9b
5 changed files with 59 additions and 59 deletions

View file

@ -8,13 +8,13 @@ def test_audio_Artist_attr(a_artist):
assert [i.tag for i in m.genres] == ['Electronic']
assert m.guid == 'com.plexapp.agents.lastfm://Infinite%20State?lang=en'
assert m.index == '1'
assert m.initpath == '/library/metadata/20'
assert m._initpath == '/library/metadata/20'
assert m.key == '/library/metadata/20'
assert m.librarySectionID == '3'
assert m.listType == 'audio'
assert m.location == '/media/music/unmastered_impulses'
assert m.ratingKey == 20
assert m.server.baseurl == 'http://138.68.157.5:32400'
assert m._root._baseurl == 'http://138.68.157.5:32400'
assert m.similar == []
assert m.summary == ""
assert m.title == 'Infinite State'
@ -55,7 +55,7 @@ def test_audio_Album_attrs(a_music_album):
assert str(m.addedAt.date()) == '2017-01-17'
assert [i.tag for i in m.genres] == ['Electronic']
assert m.index == '1'
assert m.initpath == '/library/metadata/21'
assert m._initpath == '/library/metadata/21'
assert m.key == '/library/metadata/21'
assert m.librarySectionID == '3'
assert m.listType == 'audio'
@ -65,7 +65,7 @@ def test_audio_Album_attrs(a_music_album):
assert m.parentThumb is None
assert m.parentTitle == 'Infinite State'
assert m.ratingKey == 21
assert m.server.baseurl == 'http://138.68.157.5:32400'
assert m._root._baseurl == 'http://138.68.157.5:32400'
assert m.studio is None
assert m.summary == ''
assert m.thumb == '/library/metadata/21/thumb/1484693407'
@ -84,7 +84,7 @@ def test_audio_Album_tracks(a_music_album):
assert tracks[0].grandparentRatingKey == '20'
assert tracks[0].grandparentTitle == 'Infinite State'
assert tracks[0].index == '1'
assert tracks[0].initpath == '/library/metadata/21/children'
assert tracks[0]._initpath == '/library/metadata/21/children'
assert tracks[0].key == '/library/metadata/22'
assert tracks[0].listType == 'audio'
assert tracks[0].originalTitle == 'Kenneth Reitz'
@ -96,7 +96,7 @@ def test_audio_Album_tracks(a_music_album):
assert tracks[0].player is None
assert tracks[0].ratingCount == 9
assert tracks[0].ratingKey == 22
assert tracks[0].server.baseurl == 'http://138.68.157.5:32400'
assert tracks[0]._root._baseurl == 'http://138.68.157.5:32400'
assert tracks[0].summary == ""
assert tracks[0].thumb == '/library/metadata/21/thumb/1484693407'
assert tracks[0].title == 'Holy Moment'
@ -118,7 +118,7 @@ def test_audio_Album_track(a_music_album):
assert track.grandparentRatingKey == '20'
assert track.grandparentTitle == 'Infinite State'
assert track.index == '1'
assert track.initpath == '/library/metadata/21/children'
assert track._initpath == '/library/metadata/21/children'
assert track.key == '/library/metadata/22'
assert track.listType == 'audio'
# Assign 0 track.media
@ -132,7 +132,7 @@ def test_audio_Album_track(a_music_album):
assert track.player is None
assert track.ratingCount == 9
assert track.ratingKey == 22
assert track.server.baseurl == 'http://138.68.157.5:32400'
assert track._root._baseurl == 'http://138.68.157.5:32400'
assert track.summary == ''
assert track.thumb == '/library/metadata/21/thumb/1484693407'
assert track.title == 'Holy Moment'
@ -151,11 +151,11 @@ def test_audio_Album_track(a_music_album):
assert med0.duration == 298606
assert med0.height is None
assert med0.id == 22
assert med0.initpath == '/library/metadata/21/children'
assert med0._initpath == '/library/metadata/21/children'
assert med0.optimizedForStreaming is None
# Assign 0 med0.parts
par0 = med0.parts[0]
assert med0.server.baseurl == 'http://138.68.157.5:32400'
assert med0._root._baseurl == 'http://138.68.157.5:32400'
assert med0.videoCodec is None
assert med0.videoFrameRate is None
assert med0.videoResolution is None
@ -164,9 +164,9 @@ def test_audio_Album_track(a_music_album):
assert par0.duration == 298606
assert par0.file == '/media/music/unmastered_impulses/01-Holy_Moment.mp3'
assert par0.id == 22
assert par0.initpath == '/library/metadata/21/children'
assert par0._initpath == '/library/metadata/21/children'
assert par0.key == '/library/parts/22/1484693136/file.mp3'
assert par0.server.baseurl == 'http://138.68.157.5:32400'
assert par0._root._baseurl == 'http://138.68.157.5:32400'
assert par0.size == 14360402
@ -194,7 +194,7 @@ def test_audio_Track_attrs(a_music_album):
assert track.grandparentTitle == 'Infinite State'
assert track.guid == 'local://22'
assert track.index == '1'
assert track.initpath == '/library/metadata/22'
assert track._initpath == '/library/metadata/22'
assert track.key == '/library/metadata/22'
assert track.lastViewedAt is None
assert track.librarySectionID == '3'
@ -213,7 +213,7 @@ def test_audio_Track_attrs(a_music_album):
assert track.primaryExtraKey is None
assert track.ratingCount == 9
assert track.ratingKey == 22
assert track.server.baseurl == 'http://138.68.157.5:32400'
assert track._root._baseurl == 'http://138.68.157.5:32400'
assert track.sessionKey is None
assert track.summary == ''
assert track.thumb == '/library/metadata/21/thumb/1484693407'
@ -235,11 +235,11 @@ def test_audio_Track_attrs(a_music_album):
assert med0.duration == 298606
assert med0.height is None
assert med0.id == 22
assert med0.initpath == '/library/metadata/22'
assert med0._initpath == '/library/metadata/22'
assert med0.optimizedForStreaming is None
# Assign 0 med0.parts
par0 = med0.parts[0]
assert med0.server.baseurl == 'http://138.68.157.5:32400'
assert med0._root._baseurl == 'http://138.68.157.5:32400'
assert med0.videoCodec is None
assert med0.videoFrameRate is None
assert med0.videoResolution is None
@ -248,10 +248,10 @@ def test_audio_Track_attrs(a_music_album):
assert par0.duration == 298606
assert par0.file == '/media/music/unmastered_impulses/01-Holy_Moment.mp3'
assert par0.id == 22
assert par0.initpath == '/library/metadata/22'
assert par0._initpath == '/library/metadata/22'
assert par0.key == '/library/parts/22/1484693136/file.mp3'
#assert par0.media == <Media:Holy.Moment>
assert par0.server.baseurl == 'http://138.68.157.5:32400'
assert par0._root._baseurl == 'http://138.68.157.5:32400'
assert par0.size == 14360402
# Assign 0 par0.streams
str0 = par0.streams[0]
@ -266,13 +266,13 @@ def test_audio_Track_attrs(a_music_album):
assert str0.duration is None
assert str0.id == 44
assert str0.index == 0
assert str0.initpath == '/library/metadata/22'
assert str0._initpath == '/library/metadata/22'
assert str0.language is None
assert str0.languageCode is None
#assert str0.part == <MediaPart:22>
assert str0.samplingRate == 44100
assert str0.selected is True
assert str0.server.baseurl == 'http://138.68.157.5:32400'
assert str0._root._baseurl == 'http://138.68.157.5:32400'
assert str0.streamType == 2
assert str0.title is None
assert str0.type == 2

View file

@ -28,13 +28,13 @@ def test_library_sectionByID_with_attrs(pms):
assert m.composite == '/library/sections/1/composite/1484690696'
assert str(m.createdAt.date()) == '2017-01-17'
assert m.filters == '1'
assert m.initpath == '/library/sections'
assert m._initpath == '/library/sections'
assert m.key == '1'
assert m.language == 'en'
assert m.locations == ['/media/movies']
assert m.refreshing is False
assert m.scanner == 'Plex Movie Scanner'
assert m.server.baseurl == 'http://138.68.157.5:32400'
assert m._root._baseurl == 'http://138.68.157.5:32400'
assert m.thumb == '/:/resources/movie.png'
assert m.title == 'Movies'
assert m.type == 'movie'
@ -143,11 +143,11 @@ def test_library_and_section_search_for_movie(pms):
def test_search_with_apostrophe(pms):
show_title = "Marvel's Daredevil" # Test ' in show title
result_server = pms.search(show_title)
result_root = pms.search(show_title)
result_shows = pms.library.section('TV Shows').search(show_title)
assert result_server
assert result_root
assert result_shows
assert result_server == result_shows
assert result_root == result_shows
def test_crazy_search(pms, a_movie):

View file

@ -5,7 +5,7 @@ from plexapi.utils import download
def test_server_attr(pms):
assert pms.baseurl == 'http://138.68.157.5:32400'
assert pms._baseurl == 'http://138.68.157.5:32400'
assert pms.friendlyName == 'PMS_API_TEST_SERVER'
assert pms.machineIdentifier == 'e42470b5c527c7e5ebbdc017b5a32c8c683f6f8b'
assert pms.myPlex is True
@ -32,7 +32,7 @@ def test_server_library(pms):
def test_server_url(pms):
assert 'ohno' in pms.url('ohno')
assert 'ohno' in pms._url('ohno')
def test_server_transcodeImage(tmpdir, pms, a_show):
@ -42,7 +42,7 @@ def test_server_transcodeImage(tmpdir, pms, a_show):
img_url_resize = pms.transcodeImage(a_show.banner, height, width)
gray = img_url_resize = pms.transcodeImage(a_show.banner, height, width, saturation=0)
resized_image = download(img_url_resize, savepath=str(tmpdir), filename='resize_image')
org_image = download(a_show.server.url(a_show.banner), savepath=str(tmpdir), filename='org_image')
org_image = download(a_show._root._url(a_show.banner), savepath=str(tmpdir), filename='org_image')
gray_image = download(gray, savepath=str(tmpdir), filename='gray_image')
with Image.open(resized_image) as im:
assert width, height == im.size
@ -121,7 +121,7 @@ def test_server_Server_session():
os.environ.get('PLEX_TEST_TOKEN'), session=MySession())
assert hasattr(plex.session, 'plexapi_session_test')
pl = plex.playlists()
assert hasattr(pl[0].server.session, 'plexapi_session_test')
assert hasattr(pl[0]._root._session, 'plexapi_session_test')
# TODO: Check client in test_server_Server_session.
# TODO: Check myplex in test_server_Server_session.
@ -159,7 +159,7 @@ def test_server_Server_sessions(pms):
def test_server_clients(pms):
assert len(pms.clients())
m = pms.clients()[0]
assert m.baseurl == 'http://127.0.0.1:32400'
assert m._baseurl == 'http://127.0.0.1:32400'
assert m.device is None
assert m.deviceClass == 'pc'
assert m.machineIdentifier == '89hgkrbqxaxmf45o1q2949ru'
@ -170,7 +170,7 @@ def test_server_clients(pms):
assert m.protocol == 'plex'
assert m.protocolCapabilities == ['timeline', 'playback', 'navigation', 'mirror', 'playqueues']
assert m.protocolVersion == '1'
assert m.server.baseurl == 'http://138.68.157.5:32400'
assert m._root._baseurl == 'http://138.68.157.5:32400'
assert m.state is None
assert m.title == 'Plex Web (Chrome)'
assert m.token is None

View file

@ -100,7 +100,7 @@ def test_utils_download(a_episode):
filename=a_episode.location, mocked=True)
assert without_session
with_session = utils.download(a_episode.getStreamURL(),
filename=a_episode.location, session=a_episode.server.session,
filename=a_episode.location, session=a_episode._root.session,
mocked=True)
assert with_session
img = utils.download(a_episode.thumbUrl, filename=a_episode.title, mocked=True)

View file

@ -63,7 +63,7 @@ def test_video_Movie_attrs_as_much_as_possible(a_movie_section):
assert m.fields == []
assert [i.tag for i in m.genres] == ['Animation', 'Family', 'Comedy', 'Sport', 'Adventure']
assert m.guid == 'com.plexapp.agents.imdb://tt0317219?lang=en'
assert m.initpath == '/library/metadata/2'
assert m._initpath == '/library/metadata/2'
assert m.key == '/library/metadata/2'
#assert str(m.lastViewedAt) == '2017-01-30 22:19:38' # TODO: fix me
assert m.librarySectionID == '1'
@ -80,7 +80,7 @@ def test_video_Movie_attrs_as_much_as_possible(a_movie_section):
assert m.ratingImage == 'rottentomatoes://image.rating.certified'
assert m.ratingKey == 2
assert [i.tag for i in m.roles] == ['Owen Wilson', 'Paul Newman', 'Bonnie Hunt', 'Larry the Cable Guy', 'Cheech Marin', 'Tony Shalhoub', 'Guido Quaroni', 'Jenifer Lewis', 'Paul Dooley', 'Michael Wallis', 'George Carlin', 'Katherine Helmond', 'John Ratzenberger', 'Michael Keaton', 'Joe Ranft', 'Richard Petty', 'Jeremy Piven', 'Bob Costas', 'Darrell Waltrip', 'Richard Kind', 'Edie McClurg', 'Humpy Wheeler', 'Tom Magliozzi', 'Ray Magliozzi', 'Lynda Petty', 'Andrew Stanton', 'Dale Earnhardt Jr.', 'Michael Schumacher', 'Jay Leno', 'Sarah Clark', 'Mike Nelson', 'Joe Ranft', 'Jonas Rivera', 'Lou Romano', 'Adrian Ochoa', 'E.J. Holowicki', 'Elissa Knight', 'Lindsey Collins', 'Larry Benton', 'Douglas Keever', 'Tom Hanks', 'Tim Allen', 'John Ratzenberger', 'Billy Crystal', 'John Goodman', 'John Ratzenberger', 'Dave Foley', 'John Ratzenberger', 'Vanness Wu']
assert m.server.baseurl == 'http://138.68.157.5:32400'
assert m._root._baseurl == 'http://138.68.157.5:32400'
assert m.sessionKey is None
assert m.studio == 'Walt Disney Pictures'
assert m.summary == u"Lightning McQueen, a hotshot rookie race car driven to succeed, discovers that life is about the journey, not the finish line, when he finds himself unexpectedly detoured in the sleepy Route 66 town of Radiator Springs. On route across the country to the big Piston Cup Championship in California to compete against two seasoned pros, McQueen gets to know the town's offbeat characters."
@ -111,13 +111,13 @@ def test_video_Movie_attrs_as_much_as_possible(a_movie_section):
assert aud0.duration is None
assert aud0.id == 10
assert aud0.index == 1
assert aud0.initpath == '/library/metadata/2'
assert aud0._initpath == '/library/metadata/2'
assert aud0.language is None
assert aud0.languageCode is None
#assert aud0.part == <MediaPart:2>
assert aud0.samplingRate == 48000
assert aud0.selected is True
assert aud0.server.baseurl == 'http://138.68.157.5:32400'
assert aud0._root._baseurl == 'http://138.68.157.5:32400'
assert aud0.streamType == 2
assert aud0.title is None
assert aud0.type == 2
@ -129,11 +129,11 @@ def test_video_Movie_attrs_as_much_as_possible(a_movie_section):
assert med0.duration == 170859
assert med0.height == 720
assert med0.id == 2
assert med0.initpath == '/library/metadata/2'
assert med0._initpath == '/library/metadata/2'
assert med0.optimizedForStreaming is False
# Assign 0 med0.parts
par0 = med0.parts[0]
assert med0.server.baseurl == 'http://138.68.157.5:32400'
assert med0._root._baseurl == 'http://138.68.157.5:32400'
assert med0.video == m
assert med0.videoCodec == 'h264'
assert med0.videoFrameRate == 'PAL'
@ -153,7 +153,7 @@ def test_video_Movie_attrs_as_much_as_possible(a_movie_section):
assert vid0.height == 720
assert vid0.id == 9
assert vid0.index == 0
assert vid0.initpath == '/library/metadata/2'
assert vid0._initpath == '/library/metadata/2'
assert vid0.language is None
assert vid0.languageCode is None
assert vid0.level == 31
@ -162,7 +162,7 @@ def test_video_Movie_attrs_as_much_as_possible(a_movie_section):
assert vid0.refFrames == 1
assert vid0.scanType is None
assert vid0.selected is False
assert vid0.server.baseurl == 'http://138.68.157.5:32400'
assert vid0._root._baseurl == 'http://138.68.157.5:32400'
assert vid0.streamType == 1
assert vid0.title is None
assert vid0.type == 1
@ -171,10 +171,10 @@ def test_video_Movie_attrs_as_much_as_possible(a_movie_section):
assert par0.duration == 170859
assert par0.file == '/media/movies/cars/cars.mp4'
assert par0.id == 2
assert par0.initpath == '/library/metadata/2'
assert par0._initpath == '/library/metadata/2'
assert par0.key == '/library/parts/2/1484679008/file.mp4'
#assert par0.media == <Media:Cars>
assert par0.server.baseurl == 'http://138.68.157.5:32400'
assert par0._root._baseurl == 'http://138.68.157.5:32400'
assert par0.size == 31491130
# Assign 0 par0.streams
str0 = par0.streams[0]
@ -194,7 +194,7 @@ def test_video_Movie_attrs_as_much_as_possible(a_movie_section):
assert str0.height == 720
assert str0.id == 9
assert str0.index == 0
assert str0.initpath == '/library/metadata/2'
assert str0._initpath == '/library/metadata/2'
assert str0.language is None
assert str0.languageCode is None
assert str0.level == 31
@ -203,7 +203,7 @@ def test_video_Movie_attrs_as_much_as_possible(a_movie_section):
assert str0.refFrames == 1
assert str0.scanType is None
assert str0.selected is False
assert str0.server.baseurl == 'http://138.68.157.5:32400'
assert str0._root._baseurl == 'http://138.68.157.5:32400'
assert str0.streamType == 1
assert str0.title is None
assert str0.type == 1
@ -219,13 +219,13 @@ def test_video_Movie_attrs_as_much_as_possible(a_movie_section):
assert str1.duration is None
assert str1.id == 10
assert str1.index == 1
assert str1.initpath == '/library/metadata/2'
assert str1._initpath == '/library/metadata/2'
assert str1.language is None
assert str1.languageCode is None
#assert str1.part == <MediaPart:2>
assert str1.samplingRate == 48000
assert str1.selected is True
assert str1.server.baseurl == 'http://138.68.157.5:32400'
assert str1._root._baseurl == 'http://138.68.157.5:32400'
assert str1.streamType == 2
assert str1.title is None
assert str1.type == 2
@ -243,11 +243,11 @@ def test_video_Show_attrs(a_show):
assert m.childCount == 2
assert m.contentRating == 'TV-14'
assert m.duration == 2700000
assert m.initpath == '/library/sections/2/all'
assert m._initpath == '/library/sections/2/all'
# Since we access m.genres the show is forced to reload
assert [i.tag for i in m.genres] == ['Drama', 'Science-Fiction', 'Suspense', 'Thriller']
# So the initkey should have changed because of the reload
assert m.initpath == '/library/metadata/12'
assert m._initpath == '/library/metadata/12'
assert m.index == '1'
assert m.key == '/library/metadata/12'
assert str(m.lastViewedAt.date()) == '2017-01-22'
@ -259,7 +259,7 @@ def test_video_Show_attrs(a_show):
assert m.ratingKey == 12
assert [i.tag for i in m.roles][:3] == ['Richard Harmon', 'Alycia Debnam-Carey', 'Lindsey Morgan']
assert [i.tag for i in m.actors][:3] == ['Richard Harmon', 'Alycia Debnam-Carey', 'Lindsey Morgan']
assert m.server.baseurl == 'http://138.68.157.5:32400'
assert m._root._baseurl == 'http://138.68.157.5:32400'
assert m.studio == 'The CW'
assert m.summary == u"When nuclear Armageddon destroys civilization on Earth, the only survivors are those on the 12 international space stations in orbit at the time. Three generations later, the 4,000 survivors living on a space ark of linked stations see their resources dwindle and face draconian measures established to ensure humanity's future. Desperately looking for a solution, the ark's leaders send 100 juvenile prisoners back to the planet to test its habitability. Having always lived in space, the exiles find the planet fascinating and terrifying, but with the fate of the human race in their hands, they must forge a path into the unknown."
assert '/library/metadata/12/theme/' in m.theme
@ -292,9 +292,9 @@ def test_video_Show_location(pms):
def test_video_Show_reload(pms):
s = pms.library.section('TV Shows').get('Game of Thrones')
assert s.initpath == '/library/sections/2/all'
assert s._initpath == '/library/sections/2/all'
s.reload()
assert s.initpath == '/library/metadata/6'
assert s._initpath == '/library/metadata/6'
assert len(s.roles) > 3
@ -384,7 +384,7 @@ def test_video_Episode_attrs(a_episode):
assert ep.duration == 170859
assert ep.grandparentTitle == 'The 100'
assert ep.index == 1
assert ep.initpath == '/library/metadata/12/allLeaves'
assert ep._initpath == '/library/metadata/12/allLeaves'
assert ep.key == '/library/metadata/14'
assert ep.listType == 'video'
# Assign 0 ep.media
@ -398,7 +398,7 @@ def test_video_Episode_attrs(a_episode):
assert ep.player is None
assert ep.rating == 7.4
assert ep.ratingKey == 14
assert ep.server.baseurl == 'http://138.68.157.5:32400'
assert ep._root._baseurl == 'http://138.68.157.5:32400'
assert ep.summary == u'Ninety-seven years ago, nuclear Armageddon decimated planet Earth, destroying civilization. The only survivors were the 400 inhabitants of 12 international space stations that were in orbit at the time. Three generations have been born in space, the survivors now number 4,000, and resources are running out on their dying "Ark." Among the 100 young exiles are Clarke, the bright teenage daughter of the Arks chief medical officer; the daredevil Finn; the brother/sister duo of Bellamy and Octavia, whose illegal sibling status has always led them to flaunt the rules, the lighthearted Jasper and the resourceful Monty. Technologically blind to whats happening on the planet below them, the Arks leaders — Clarkes widowed mother, Abby; Chancellor Jaha; and his shadowy second in command, Kane — are faced with difficult decisions about life, death and the continued existence of the human race.'
assert ep.thumb == '/library/metadata/14/thumb/1485115318'
assert ep.title == 'Pilot'
@ -419,11 +419,11 @@ def test_video_Episode_attrs(a_episode):
assert med0.duration == 170859
assert med0.height == 720
assert med0.id == 12
assert med0.initpath == '/library/metadata/12/allLeaves'
assert med0._initpath == '/library/metadata/12/allLeaves'
assert med0.optimizedForStreaming is False
# Assign 0 med0.parts
par0 = med0.parts[0]
assert med0.server.baseurl == 'http://138.68.157.5:32400'
assert med0._root._baseurl == 'http://138.68.157.5:32400'
#assert med0.video == <Episode:14:The 100:S1:E1:Pilot>
assert med0.videoCodec == 'h264'
assert med0.videoFrameRate == 'PAL'
@ -433,10 +433,10 @@ def test_video_Episode_attrs(a_episode):
assert par0.duration == 170859
assert par0.file == '/media/tvshows/the 100/season 1/the.100.s01e01.mp4'
assert par0.id == 12
assert par0.initpath == '/library/metadata/12/allLeaves'
assert par0._initpath == '/library/metadata/12/allLeaves'
assert par0.key == '/library/parts/12/1484679008/file.mp4'
#assert par0.media == <Media:Pilot>
assert par0.server.baseurl == 'http://138.68.157.5:32400'
assert par0._root._baseurl == 'http://138.68.157.5:32400'
assert par0.size == 31491130
assert ep.isWatched is True
@ -452,7 +452,7 @@ def test_video_Season_attrs(a_show):
m = a_show.season('Season 1')
assert str(m.addedAt.date()) == '2017-01-17'
assert m.index == 1
assert m.initpath == '/library/metadata/12/children'
assert m._initpath == '/library/metadata/12/children'
assert m.key == '/library/metadata/13'
assert str(m.lastViewedAt.date()) == '2017-01-22'
assert m.leafCount == 8
@ -461,7 +461,7 @@ def test_video_Season_attrs(a_show):
assert m.parentRatingKey == 12
assert m.parentTitle == 'The 100'
assert m.ratingKey == 13
assert m.server.baseurl == 'http://138.68.157.5:32400'
assert m._root._baseurl == 'http://138.68.157.5:32400'
assert m.summary == ''
assert '/library/metadata/13/thumb/' in m.thumb
#assert m.thumb == '/library/metadata/13/thumb/1485096623'