mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-21 19:23:05 +00:00
Move pytests up to main tests folder; Move old tests to archived folder
This commit is contained in:
parent
cec0ab07e8
commit
45857f9fb7
31 changed files with 641 additions and 642 deletions
|
@ -0,0 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
from os.path import dirname, abspath
|
||||
|
||||
# Make sure plexapi is in the systempath
|
||||
sys.path.insert(0, dirname(dirname(abspath(__file__))))
|
0
tests/archived/__init__.py
Normal file
0
tests/archived/__init__.py
Normal file
29
tests/archived/test_actions.py
Normal file
29
tests/archived/test_actions.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from utils import log, register
|
||||
from plexapi import CONFIG
|
||||
|
||||
|
||||
@register()
|
||||
def test_mark_movie_watched(account, plex):
|
||||
movie = plex.library.section(CONFIG.movie_section).get(CONFIG.movie_title)
|
||||
movie.markUnwatched()
|
||||
log(2, 'Marking movie watched: %s' % movie)
|
||||
log(2, 'View count: %s' % movie.viewCount)
|
||||
movie.markWatched()
|
||||
log(2, 'View count: %s' % movie.viewCount)
|
||||
assert movie.viewCount == 1, 'View count 0 after watched.'
|
||||
movie.markUnwatched()
|
||||
log(2, 'View count: %s' % movie.viewCount)
|
||||
assert movie.viewCount == 0, 'View count 1 after unwatched.'
|
||||
|
||||
|
||||
@register()
|
||||
def test_refresh_section(account, plex):
|
||||
shows = plex.library.section(CONFIG.movie_section)
|
||||
shows.refresh()
|
||||
|
||||
|
||||
@register()
|
||||
def test_refresh_video(account, plex):
|
||||
result = plex.search(CONFIG.movie_title)
|
||||
result[0].refresh()
|
132
tests/archived/test_client.py
Normal file
132
tests/archived/test_client.py
Normal file
|
@ -0,0 +1,132 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import time
|
||||
from utils import log, register, getclient
|
||||
from plexapi import CONFIG
|
||||
|
||||
|
||||
@register()
|
||||
def test_list_clients(account, plex):
|
||||
clients = [c.title for c in plex.clients()]
|
||||
log(2, 'Clients: %s' % ', '.join(clients or []))
|
||||
assert clients, 'Server is not listing any clients.'
|
||||
|
||||
|
||||
@register()
|
||||
def test_client_navigation(account, plex):
|
||||
client = getclient(CONFIG.client, CONFIG.client_baseurl, plex)
|
||||
_navigate(plex, client)
|
||||
|
||||
|
||||
@register()
|
||||
def test_client_navigation_via_proxy(account, plex):
|
||||
client = getclient(CONFIG.client, CONFIG.client_baseurl, plex)
|
||||
client.proxyThroughServer()
|
||||
_navigate(plex, client)
|
||||
|
||||
|
||||
def _navigate(plex, client):
|
||||
episode = plex.library.section(CONFIG.show_section).get(CONFIG.show_title).get(CONFIG.show_episode)
|
||||
artist = plex.library.section(CONFIG.audio_section).get(CONFIG.audio_artist)
|
||||
log(2, 'Client: %s (%s)' % (client.title, client.product))
|
||||
log(2, 'Capabilities: %s' % client.protocolCapabilities)
|
||||
# Move around a bit
|
||||
log(2, 'Browsing around..')
|
||||
client.moveDown(); time.sleep(0.5)
|
||||
client.moveDown(); time.sleep(0.5)
|
||||
client.moveDown(); time.sleep(0.5)
|
||||
client.select(); time.sleep(3)
|
||||
client.moveRight(); time.sleep(0.5)
|
||||
client.moveRight(); time.sleep(0.5)
|
||||
client.moveLeft(); time.sleep(0.5)
|
||||
client.select(); time.sleep(3)
|
||||
client.goBack(); time.sleep(1)
|
||||
client.goBack(); time.sleep(3)
|
||||
# Go directly to media
|
||||
log(2, 'Navigating to %s..' % episode.title)
|
||||
client.goToMedia(episode); time.sleep(5)
|
||||
log(2, 'Navigating to %s..' % artist.title)
|
||||
client.goToMedia(artist); time.sleep(5)
|
||||
log(2, 'Navigating home..')
|
||||
client.goToHome(); time.sleep(5)
|
||||
client.moveUp(); time.sleep(0.5)
|
||||
client.moveUp(); time.sleep(0.5)
|
||||
client.moveUp(); time.sleep(0.5)
|
||||
# Show context menu
|
||||
client.contextMenu(); time.sleep(3)
|
||||
client.goBack(); time.sleep(5)
|
||||
|
||||
|
||||
@register()
|
||||
def test_video_playback(account, plex):
|
||||
client = getclient(CONFIG.client, CONFIG.client_baseurl, plex)
|
||||
_video_playback(plex, client)
|
||||
|
||||
|
||||
@register()
|
||||
def test_video_playback_via_proxy(account, plex):
|
||||
client = getclient(CONFIG.client, CONFIG.client_baseurl, plex)
|
||||
client.proxyThroughServer()
|
||||
_video_playback(plex, client)
|
||||
|
||||
|
||||
def _video_playback(plex, client):
|
||||
try:
|
||||
mtype = 'video'
|
||||
movie = plex.library.section(CONFIG.movie_section).get(CONFIG.movie_title)
|
||||
subs = [s for s in movie.subtitleStreams if s.language == 'English']
|
||||
log(2, 'Client: %s (%s)' % (client.title, client.product))
|
||||
log(2, 'Capabilities: %s' % client.protocolCapabilities)
|
||||
log(2, 'Playing to %s..' % movie.title)
|
||||
client.playMedia(movie); time.sleep(5)
|
||||
log(2, 'Pause..')
|
||||
client.pause(mtype); time.sleep(2)
|
||||
log(2, 'Step Forward..')
|
||||
client.stepForward(mtype); time.sleep(5)
|
||||
log(2, 'Play..')
|
||||
client.play(mtype); time.sleep(3)
|
||||
log(2, 'Seek to 10m..')
|
||||
client.seekTo(10*60*1000); time.sleep(5)
|
||||
log(2, 'Disable Subtitles..')
|
||||
client.setSubtitleStream(0, mtype); time.sleep(10)
|
||||
log(2, 'Load English Subtitles %s..' % subs[0].id)
|
||||
client.setSubtitleStream(subs[0].id, mtype); time.sleep(10)
|
||||
log(2, 'Stop..')
|
||||
client.stop(mtype); time.sleep(1)
|
||||
finally:
|
||||
log(2, 'Cleanup: Marking %s watched.' % movie.title)
|
||||
movie.markWatched()
|
||||
|
||||
|
||||
@register()
|
||||
def test_client_timeline(account, plex):
|
||||
client = getclient(CONFIG.client, CONFIG.client_baseurl, plex)
|
||||
_test_timeline(plex, client)
|
||||
|
||||
|
||||
@register()
|
||||
def test_client_timeline_via_proxy(account, plex):
|
||||
client = getclient(CONFIG.client, CONFIG.client_baseurl, plex)
|
||||
client.proxyThroughServer()
|
||||
_test_timeline(plex, client)
|
||||
|
||||
|
||||
def _test_timeline(plex, client):
|
||||
try:
|
||||
mtype = 'video'
|
||||
client = getclient(CONFIG.client, CONFIG.client_baseurl, plex)
|
||||
movie = plex.library.section(CONFIG.movie_section).get(CONFIG.movie_title)
|
||||
time.sleep(30) # previous test may have played media..
|
||||
playing = client.isPlayingMedia()
|
||||
log(2, 'Playing Media: %s' % playing)
|
||||
assert playing is False, 'isPlayingMedia() should have returned False.'
|
||||
client.playMedia(movie); time.sleep(30)
|
||||
playing = client.isPlayingMedia()
|
||||
log(2, 'Playing Media: %s' % playing)
|
||||
assert playing is True, 'isPlayingMedia() should have returned True.'
|
||||
client.stop(mtype); time.sleep(30)
|
||||
playing = client.isPlayingMedia()
|
||||
log(2, 'Playing Media: %s' % playing)
|
||||
assert playing is False, 'isPlayingMedia() should have returned False.'
|
||||
finally:
|
||||
log(2, 'Cleanup: Marking %s watched.' % movie.title)
|
||||
movie.markWatched()
|
72
tests/archived/test_myplex.py
Normal file
72
tests/archived/test_myplex.py
Normal file
|
@ -0,0 +1,72 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from utils import log, register
|
||||
from plexapi import CONFIG
|
||||
|
||||
|
||||
@register()
|
||||
def test_myplex_accounts(account, plex):
|
||||
assert account, 'Must specify username, password & resource to run this test.'
|
||||
log(2, 'MyPlexAccount:')
|
||||
log(4, 'username: %s' % account.username)
|
||||
log(4, 'authenticationToken: %s' % account.authenticationToken)
|
||||
log(4, 'email: %s' % account.email)
|
||||
log(4, 'home: %s' % account.home)
|
||||
log(4, 'queueEmail: %s' % account.queueEmail)
|
||||
assert account.username, 'Account has no username'
|
||||
assert account.authenticationToken, 'Account has no authenticationToken'
|
||||
assert account.email, 'Account has no email'
|
||||
assert account.home is not None, 'Account has no home'
|
||||
assert account.queueEmail, 'Account has no queueEmail'
|
||||
account = plex.account()
|
||||
log(2, 'Local PlexServer.account():')
|
||||
log(4, 'username: %s' % account.username)
|
||||
log(4, 'authToken: %s' % account.authToken)
|
||||
log(4, 'signInState: %s' % account.signInState)
|
||||
assert account.username, 'Account has no username'
|
||||
assert account.authToken, 'Account has no authToken'
|
||||
assert account.signInState, 'Account has no signInState'
|
||||
|
||||
|
||||
@register()
|
||||
def test_myplex_resources(account, plex):
|
||||
assert account, 'Must specify username, password & resource to run this test.'
|
||||
resources = account.resources()
|
||||
for resource in resources:
|
||||
name = resource.name or 'Unknown'
|
||||
connections = [c.uri for c in resource.connections]
|
||||
connections = ', '.join(connections) if connections else 'None'
|
||||
log(2, '%s (%s): %s' % (name, resource.product, connections))
|
||||
assert resources, 'No resources found for account: %s' % account.name
|
||||
|
||||
|
||||
@register()
|
||||
def test_myplex_devices(account, plex):
|
||||
assert account, 'Must specify username, password & resource to run this test.'
|
||||
devices = account.devices()
|
||||
for device in devices:
|
||||
name = device.name or 'Unknown'
|
||||
connections = ', '.join(device.connections) if device.connections else 'None'
|
||||
log(2, '%s (%s): %s' % (name, device.product, connections))
|
||||
assert devices, 'No devices found for account: %s' % account.name
|
||||
|
||||
|
||||
@register()
|
||||
def test_myplex_users(account, plex):
|
||||
users = account.users()
|
||||
assert users, 'Found no users on account: %s' % account.name
|
||||
log(2, 'Found %s users.' % len(users))
|
||||
user = account.user('sdfsdfplex')
|
||||
log(2, 'Found user: %s' % user)
|
||||
assert users, 'Could not find user sdfsdfplex'
|
||||
|
||||
|
||||
@register()
|
||||
def test_myplex_connect_to_device(account, plex):
|
||||
assert account, 'Must specify username, password & resource to run this test.'
|
||||
devices = account.devices()
|
||||
for device in devices:
|
||||
if device.name == CONFIG.client and len(device.connections):
|
||||
break
|
||||
client = device.connect()
|
||||
log(2, 'Connected to client: %s (%s)' % (client.title, client.product))
|
||||
assert client, 'Unable to connect to device'
|
70
tests/archived/test_navigation.py
Normal file
70
tests/archived/test_navigation.py
Normal file
|
@ -0,0 +1,70 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from utils import log, register
|
||||
from plexapi import CONFIG
|
||||
|
||||
|
||||
# TODO: test_navigation/test_navigate_to_movie
|
||||
# FAIL: (500) internal_server_error
|
||||
# @register()
|
||||
def test_navigate_to_movie(account, plex):
|
||||
result_library = plex.library.get(CONFIG.movie_title)
|
||||
result_movies = plex.library.section(CONFIG.movie_section).get(CONFIG.movie_title)
|
||||
log(2, 'Navigating to: %s' % CONFIG.movie_title)
|
||||
log(2, 'Result Library: %s' % result_library)
|
||||
log(2, 'Result Movies: %s' % result_movies)
|
||||
assert result_movies, 'Movie navigation not working.'
|
||||
assert result_library == result_movies, 'Movie navigation not consistent.'
|
||||
|
||||
|
||||
@register()
|
||||
def test_navigate_to_show(account, plex):
|
||||
result_shows = plex.library.section(CONFIG.show_section).get(CONFIG.show_title)
|
||||
log(2, 'Navigating to: %s' % CONFIG.show_title)
|
||||
log(2, 'Result Shows: %s' % result_shows)
|
||||
assert result_shows, 'Show navigation not working.'
|
||||
|
||||
|
||||
# TODO: Fix test_navigation/test_navigate_around_show
|
||||
# FAIL: Unable to list season: Season 1
|
||||
# @register()
|
||||
def test_navigate_around_show(account, plex):
|
||||
show = plex.library.section(CONFIG.show_section).get(CONFIG.show_title)
|
||||
seasons = show.seasons()
|
||||
season = show.season(CONFIG.show_season)
|
||||
episodes = show.episodes()
|
||||
episode = show.episode(CONFIG.show_episode)
|
||||
log(2, 'Navigating around show: %s' % show)
|
||||
log(2, 'Seasons: %s...' % seasons[:3])
|
||||
log(2, 'Season: %s' % season)
|
||||
log(2, 'Episodes: %s...' % episodes[:3])
|
||||
log(2, 'Episode: %s' % episode)
|
||||
assert CONFIG.show_season in [s.title for s in seasons], 'Unable to list season: %s' % CONFIG.show_season
|
||||
assert CONFIG.show_episode in [e.title for e in episodes], 'Unable to list episode: %s' % CONFIG.show_episode
|
||||
assert show.season(CONFIG.show_season) == season, 'Unable to get show season: %s' % CONFIG.show_season
|
||||
assert show.episode(CONFIG.show_episode) == episode, 'Unable to get show episode: %s' % CONFIG.show_episode
|
||||
assert season.episode(CONFIG.show_episode) == episode, 'Unable to get season episode: %s' % CONFIG.show_episode
|
||||
assert season.show() == show, 'season.show() doesnt match expected show.'
|
||||
assert episode.show() == show, 'episode.show() doesnt match expected show.'
|
||||
assert episode.season() == season, 'episode.season() doesnt match expected season.'
|
||||
|
||||
|
||||
@register()
|
||||
def test_navigate_around_artist(account, plex):
|
||||
artist = plex.library.section(CONFIG.audio_section).get(CONFIG.audio_artist)
|
||||
albums = artist.albums()
|
||||
album = artist.album(CONFIG.audio_album)
|
||||
tracks = artist.tracks()
|
||||
track = artist.track(CONFIG.audio_track)
|
||||
log(2, 'Navigating around artist: %s' % artist)
|
||||
log(2, 'Albums: %s...' % albums[:3])
|
||||
log(2, 'Album: %s' % album)
|
||||
log(2, 'Tracks: %s...' % tracks[:3])
|
||||
log(2, 'Track: %s' % track)
|
||||
assert CONFIG.audio_album in [a.title for a in albums], 'Unable to list album: %s' % CONFIG.audio_album
|
||||
assert CONFIG.audio_track in [e.title for e in tracks], 'Unable to list track: %s' % CONFIG.audio_track
|
||||
assert artist.album(CONFIG.audio_album) == album, 'Unable to get artist album: %s' % CONFIG.audio_album
|
||||
assert artist.track(CONFIG.audio_track) == track, 'Unable to get artist track: %s' % CONFIG.audio_track
|
||||
assert album.track(CONFIG.audio_track) == track, 'Unable to get album track: %s' % CONFIG.audio_track
|
||||
assert album.artist() == artist, 'album.artist() doesnt match expected artist.'
|
||||
assert track.artist() == artist, 'track.artist() doesnt match expected artist.'
|
||||
assert track.album() == album, 'track.album() doesnt match expected album.'
|
95
tests/archived/test_search.py
Normal file
95
tests/archived/test_search.py
Normal file
|
@ -0,0 +1,95 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from utils import log, register
|
||||
from plexapi import CONFIG
|
||||
|
||||
|
||||
@register()
|
||||
def test_search_show(account, plex):
|
||||
result_server = plex.search(CONFIG.show_title)
|
||||
result_shows = plex.library.section(CONFIG.show_section).search(CONFIG.show_title)
|
||||
result_movies = plex.library.section(CONFIG.movie_section).search(CONFIG.show_title)
|
||||
log(2, 'Searching for: %s' % CONFIG.show_title)
|
||||
log(4, 'Result Server: %s' % result_server)
|
||||
log(4, 'Result Shows: %s' % result_shows)
|
||||
log(4, 'Result Movies: %s' % result_movies)
|
||||
assert result_server, 'Show not found.'
|
||||
assert result_server == result_shows, 'Show searches not consistent.'
|
||||
assert not result_movies, 'Movie search returned show title.'
|
||||
|
||||
|
||||
@register()
|
||||
def test_search_with_apostrophe(account, plex):
|
||||
show_title = "Marvel's Daredevil" # Test ' in show title
|
||||
result_server = plex.search(show_title)
|
||||
result_shows = plex.library.section(CONFIG.show_section).search(show_title)
|
||||
log(2, 'Searching for: %s' % CONFIG.show_title)
|
||||
log(4, 'Result Server: %s' % result_server)
|
||||
log(4, 'Result Shows: %s' % result_shows)
|
||||
assert result_server, 'Show not found.'
|
||||
assert result_server == result_shows, 'Show searches not consistent.'
|
||||
|
||||
|
||||
@register()
|
||||
def test_search_movie(account, plex):
|
||||
result_server = plex.search(CONFIG.movie_title)
|
||||
result_library = plex.library.search(CONFIG.movie_title)
|
||||
result_shows = plex.library.section(CONFIG.show_section).search(CONFIG.movie_title)
|
||||
result_movies = plex.library.section(CONFIG.movie_section).search(CONFIG.movie_title)
|
||||
log(2, 'Searching for: %s' % CONFIG.movie_title)
|
||||
log(4, 'Result Server: %s' % result_server)
|
||||
log(4, 'Result Library: %s' % result_library)
|
||||
log(4, 'Result Shows: %s' % result_shows)
|
||||
log(4, 'Result Movies: %s' % result_movies)
|
||||
assert result_server, 'Movie not found.'
|
||||
assert result_server == result_library == result_movies, 'Movie searches not consistent.'
|
||||
assert not result_shows, 'Show search returned show title.'
|
||||
|
||||
|
||||
@register()
|
||||
def test_search_audio(account, plex):
|
||||
result_server = plex.search(CONFIG.audio_artist)
|
||||
result_library = plex.library.search(CONFIG.audio_artist)
|
||||
result_music = plex.library.section(CONFIG.audio_section).search(CONFIG.audio_artist)
|
||||
log(2, 'Searching for: %s' % CONFIG.audio_artist)
|
||||
log(4, 'Result Server: %s' % result_server)
|
||||
log(4, 'Result Library: %s' % result_library)
|
||||
log(4, 'Result Music: %s' % result_music)
|
||||
assert result_server, 'Artist not found.'
|
||||
assert result_server == result_library == result_music, 'Audio searches not consistent.'
|
||||
|
||||
|
||||
@register()
|
||||
def test_search_related(account, plex):
|
||||
movies = plex.library.section(CONFIG.movie_section)
|
||||
movie = movies.get(CONFIG.movie_title)
|
||||
related_by_actors = movies.search(actor=movie.actors, maxresults=3)
|
||||
log(2, u'Actors: %s..' % movie.actors)
|
||||
log(2, u'Related by Actors: %s..' % related_by_actors)
|
||||
assert related_by_actors, 'No related movies found by actor.'
|
||||
related_by_genre = movies.search(genre=movie.genres, maxresults=3)
|
||||
log(2, u'Genres: %s..' % movie.genres)
|
||||
log(2, u'Related by Genre: %s..' % related_by_genre)
|
||||
assert related_by_genre, 'No related movies found by genre.'
|
||||
related_by_director = movies.search(director=movie.directors, maxresults=3)
|
||||
log(2, 'Directors: %s..' % movie.directors)
|
||||
log(2, 'Related by Director: %s..' % related_by_director)
|
||||
assert related_by_director, 'No related movies found by director.'
|
||||
|
||||
|
||||
# TODO: Fix test_search/test_crazy_search
|
||||
# FAIL: Unable to search movie by director.
|
||||
# @register()
|
||||
def test_crazy_search(account, plex):
|
||||
movies = plex.library.section(CONFIG.movie_section)
|
||||
movie = movies.get('Jurassic World')
|
||||
log(2, u'Search by Actor: "Chris Pratt"')
|
||||
assert movie in movies.search(actor='Chris Pratt'), 'Unable to search movie by actor.'
|
||||
log(2, u'Search by Director: ["Trevorrow"]')
|
||||
assert movie in movies.search(director=['Trevorrow']), 'Unable to search movie by director.'
|
||||
log(2, u'Search by Year: ["2014", "2015"]')
|
||||
assert movie in movies.search(year=['2014', '2015']), 'Unable to search movie by year.'
|
||||
log(2, u'Filter by Year: 2014')
|
||||
assert movie not in movies.search(year=2014), 'Unable to filter movie by year.'
|
||||
judy = [a for a in movie.actors if 'Judy' in a.tag][0]
|
||||
log(2, u'Search by Unpopular Actor: %s' % judy)
|
||||
assert movie in movies.search(actor=judy.id), 'Unable to filter movie by year.'
|
|
@ -1,29 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from utils import log, register
|
||||
from plexapi import CONFIG
|
||||
def test_mark_movie_watched(a_movie):
|
||||
a_movie.markUnwatched()
|
||||
print('Marking movie watched: %s' % a_movie)
|
||||
print('View count: %s' % a_movie.viewCount)
|
||||
a_movie.markWatched()
|
||||
print('View count: %s' % a_movie.viewCount)
|
||||
assert a_movie.viewCount == 1, 'View count 0 after watched.'
|
||||
a_movie.markUnwatched()
|
||||
print('View count: %s' % a_movie.viewCount)
|
||||
assert a_movie.viewCount == 0, 'View count 1 after unwatched.'
|
||||
|
||||
|
||||
@register()
|
||||
def test_mark_movie_watched(account, plex):
|
||||
movie = plex.library.section(CONFIG.movie_section).get(CONFIG.movie_title)
|
||||
movie.markUnwatched()
|
||||
log(2, 'Marking movie watched: %s' % movie)
|
||||
log(2, 'View count: %s' % movie.viewCount)
|
||||
movie.markWatched()
|
||||
log(2, 'View count: %s' % movie.viewCount)
|
||||
assert movie.viewCount == 1, 'View count 0 after watched.'
|
||||
movie.markUnwatched()
|
||||
log(2, 'View count: %s' % movie.viewCount)
|
||||
assert movie.viewCount == 0, 'View count 1 after unwatched.'
|
||||
def test_refresh_section(pms):
|
||||
shows = pms.library.section('TV Shows')
|
||||
#shows.refresh()
|
||||
|
||||
|
||||
@register()
|
||||
def test_refresh_section(account, plex):
|
||||
shows = plex.library.section(CONFIG.movie_section)
|
||||
shows.refresh()
|
||||
|
||||
|
||||
@register()
|
||||
def test_refresh_video(account, plex):
|
||||
result = plex.search(CONFIG.movie_title)
|
||||
result[0].refresh()
|
||||
def test_refresh_video(pms):
|
||||
result = pms.search('16 blocks')
|
||||
#result[0].refresh()
|
||||
|
|
|
@ -1,132 +1,173 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import time
|
||||
from utils import log, register, getclient
|
||||
from plexapi import CONFIG
|
||||
import pytest
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient__loadData(pms):
|
||||
pass
|
||||
|
||||
@register()
|
||||
def test_list_clients(account, plex):
|
||||
clients = [c.title for c in plex.clients()]
|
||||
log(2, 'Clients: %s' % ', '.join(clients or []))
|
||||
assert clients, 'Server is not listing any clients.'
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_connect(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_contextMenu(pms):
|
||||
pass
|
||||
|
||||
@register()
|
||||
def test_client_navigation(account, plex):
|
||||
client = getclient(CONFIG.client, CONFIG.client_baseurl, plex)
|
||||
_navigate(plex, client)
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_goBack(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_goToHome(pms):
|
||||
pass
|
||||
|
||||
@register()
|
||||
def test_client_navigation_via_proxy(account, plex):
|
||||
client = getclient(CONFIG.client, CONFIG.client_baseurl, plex)
|
||||
client.proxyThroughServer()
|
||||
_navigate(plex, client)
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_goToMedia(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_goToMusic(pms):
|
||||
pass
|
||||
|
||||
def _navigate(plex, client):
|
||||
episode = plex.library.section(CONFIG.show_section).get(CONFIG.show_title).get(CONFIG.show_episode)
|
||||
artist = plex.library.section(CONFIG.audio_section).get(CONFIG.audio_artist)
|
||||
log(2, 'Client: %s (%s)' % (client.title, client.product))
|
||||
log(2, 'Capabilities: %s' % client.protocolCapabilities)
|
||||
# Move around a bit
|
||||
log(2, 'Browsing around..')
|
||||
client.moveDown(); time.sleep(0.5)
|
||||
client.moveDown(); time.sleep(0.5)
|
||||
client.moveDown(); time.sleep(0.5)
|
||||
client.select(); time.sleep(3)
|
||||
client.moveRight(); time.sleep(0.5)
|
||||
client.moveRight(); time.sleep(0.5)
|
||||
client.moveLeft(); time.sleep(0.5)
|
||||
client.select(); time.sleep(3)
|
||||
client.goBack(); time.sleep(1)
|
||||
client.goBack(); time.sleep(3)
|
||||
# Go directly to media
|
||||
log(2, 'Navigating to %s..' % episode.title)
|
||||
client.goToMedia(episode); time.sleep(5)
|
||||
log(2, 'Navigating to %s..' % artist.title)
|
||||
client.goToMedia(artist); time.sleep(5)
|
||||
log(2, 'Navigating home..')
|
||||
client.goToHome(); time.sleep(5)
|
||||
client.moveUp(); time.sleep(0.5)
|
||||
client.moveUp(); time.sleep(0.5)
|
||||
client.moveUp(); time.sleep(0.5)
|
||||
# Show context menu
|
||||
client.contextMenu(); time.sleep(3)
|
||||
client.goBack(); time.sleep(5)
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_headers(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_isPlayingMedia(pms):
|
||||
pass
|
||||
|
||||
@register()
|
||||
def test_video_playback(account, plex):
|
||||
client = getclient(CONFIG.client, CONFIG.client_baseurl, plex)
|
||||
_video_playback(plex, client)
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_moveDown(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_moveLeft(pms):
|
||||
pass
|
||||
|
||||
@register()
|
||||
def test_video_playback_via_proxy(account, plex):
|
||||
client = getclient(CONFIG.client, CONFIG.client_baseurl, plex)
|
||||
client.proxyThroughServer()
|
||||
_video_playback(plex, client)
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_moveRight(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_moveUp(pms):
|
||||
pass
|
||||
|
||||
def _video_playback(plex, client):
|
||||
try:
|
||||
mtype = 'video'
|
||||
movie = plex.library.section(CONFIG.movie_section).get(CONFIG.movie_title)
|
||||
subs = [s for s in movie.subtitleStreams if s.language == 'English']
|
||||
log(2, 'Client: %s (%s)' % (client.title, client.product))
|
||||
log(2, 'Capabilities: %s' % client.protocolCapabilities)
|
||||
log(2, 'Playing to %s..' % movie.title)
|
||||
client.playMedia(movie); time.sleep(5)
|
||||
log(2, 'Pause..')
|
||||
client.pause(mtype); time.sleep(2)
|
||||
log(2, 'Step Forward..')
|
||||
client.stepForward(mtype); time.sleep(5)
|
||||
log(2, 'Play..')
|
||||
client.play(mtype); time.sleep(3)
|
||||
log(2, 'Seek to 10m..')
|
||||
client.seekTo(10*60*1000); time.sleep(5)
|
||||
log(2, 'Disable Subtitles..')
|
||||
client.setSubtitleStream(0, mtype); time.sleep(10)
|
||||
log(2, 'Load English Subtitles %s..' % subs[0].id)
|
||||
client.setSubtitleStream(subs[0].id, mtype); time.sleep(10)
|
||||
log(2, 'Stop..')
|
||||
client.stop(mtype); time.sleep(1)
|
||||
finally:
|
||||
log(2, 'Cleanup: Marking %s watched.' % movie.title)
|
||||
movie.markWatched()
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_nextLetter(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_pageDown(pms):
|
||||
pass
|
||||
|
||||
@register()
|
||||
def test_client_timeline(account, plex):
|
||||
client = getclient(CONFIG.client, CONFIG.client_baseurl, plex)
|
||||
_test_timeline(plex, client)
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_pageUp(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_pause(pms):
|
||||
pass
|
||||
|
||||
@register()
|
||||
def test_client_timeline_via_proxy(account, plex):
|
||||
client = getclient(CONFIG.client, CONFIG.client_baseurl, plex)
|
||||
client.proxyThroughServer()
|
||||
_test_timeline(plex, client)
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_play(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_playMedia(pms):
|
||||
pass
|
||||
|
||||
def _test_timeline(plex, client):
|
||||
try:
|
||||
mtype = 'video'
|
||||
client = getclient(CONFIG.client, CONFIG.client_baseurl, plex)
|
||||
movie = plex.library.section(CONFIG.movie_section).get(CONFIG.movie_title)
|
||||
time.sleep(30) # previous test may have played media..
|
||||
playing = client.isPlayingMedia()
|
||||
log(2, 'Playing Media: %s' % playing)
|
||||
assert playing is False, 'isPlayingMedia() should have returned False.'
|
||||
client.playMedia(movie); time.sleep(30)
|
||||
playing = client.isPlayingMedia()
|
||||
log(2, 'Playing Media: %s' % playing)
|
||||
assert playing is True, 'isPlayingMedia() should have returned True.'
|
||||
client.stop(mtype); time.sleep(30)
|
||||
playing = client.isPlayingMedia()
|
||||
log(2, 'Playing Media: %s' % playing)
|
||||
assert playing is False, 'isPlayingMedia() should have returned False.'
|
||||
finally:
|
||||
log(2, 'Cleanup: Marking %s watched.' % movie.title)
|
||||
movie.markWatched()
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_previousLetter(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_proxyThroughServer(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_query(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_refreshPlayQueue(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_seekTo(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_select(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_sendCommand(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_setAudioStream(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_setParameters(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_setRepeat(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_setShuffle(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_setStreams(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_setSubtitleStream(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_setVideoStream(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_setVolume(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_skipNext(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_skipPrevious(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_skipTo(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_stepBack(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_stepForward(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_stop(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_timeline(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_toggleOSD(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_url(pms):
|
||||
pass
|
||||
|
|
|
@ -1,72 +1,78 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from utils import log, register
|
||||
from plexapi import CONFIG
|
||||
import pytest
|
||||
|
||||
|
||||
@register()
|
||||
def test_myplex_accounts(account, plex):
|
||||
def test_myplex_accounts(plex_account, pms):
|
||||
account = plex_account
|
||||
assert account, 'Must specify username, password & resource to run this test.'
|
||||
log(2, 'MyPlexAccount:')
|
||||
log(4, 'username: %s' % account.username)
|
||||
log(4, 'authenticationToken: %s' % account.authenticationToken)
|
||||
log(4, 'email: %s' % account.email)
|
||||
log(4, 'home: %s' % account.home)
|
||||
log(4, 'queueEmail: %s' % account.queueEmail)
|
||||
print('MyPlexAccount:')
|
||||
print('username: %s' % account.username)
|
||||
#print('authenticationToken: %s' % account.authenticationToken)
|
||||
print('email: %s' % account.email)
|
||||
print('home: %s' % account.home)
|
||||
print('queueEmail: %s' % account.queueEmail)
|
||||
assert account.username, 'Account has no username'
|
||||
assert account.authenticationToken, 'Account has no authenticationToken'
|
||||
assert account.email, 'Account has no email'
|
||||
assert account.home is not None, 'Account has no home'
|
||||
assert account.queueEmail, 'Account has no queueEmail'
|
||||
account = plex.account()
|
||||
log(2, 'Local PlexServer.account():')
|
||||
log(4, 'username: %s' % account.username)
|
||||
log(4, 'authToken: %s' % account.authToken)
|
||||
log(4, 'signInState: %s' % account.signInState)
|
||||
account = pms.account()
|
||||
print('Local PlexServer.account():')
|
||||
print('username: %s' % account.username)
|
||||
print('authToken: %s' % account.authToken)
|
||||
print('signInState: %s' % account.signInState)
|
||||
assert account.username, 'Account has no username'
|
||||
assert account.authToken, 'Account has no authToken'
|
||||
assert account.signInState, 'Account has no signInState'
|
||||
|
||||
|
||||
@register()
|
||||
def test_myplex_resources(account, plex):
|
||||
def test_myplex_resources(plex_account):
|
||||
account = plex_account
|
||||
assert account, 'Must specify username, password & resource to run this test.'
|
||||
resources = account.resources()
|
||||
for resource in resources:
|
||||
name = resource.name or 'Unknown'
|
||||
connections = [c.uri for c in resource.connections]
|
||||
connections = ', '.join(connections) if connections else 'None'
|
||||
log(2, '%s (%s): %s' % (name, resource.product, connections))
|
||||
print('%s (%s): %s' % (name, resource.product, connections))
|
||||
assert resources, 'No resources found for account: %s' % account.name
|
||||
|
||||
|
||||
@register()
|
||||
def test_myplex_devices(account, plex):
|
||||
assert account, 'Must specify username, password & resource to run this test.'
|
||||
def test_myplex_connect_to_resource(plex_account):
|
||||
for resource in plex_account.resources():
|
||||
if resource.name == 'PMS_API_TEST_SERVER':
|
||||
break
|
||||
server = resource.connect()
|
||||
assert 'Ohno' in server.url('Ohno')
|
||||
assert server
|
||||
|
||||
|
||||
def test_myplex_devices(plex_account):
|
||||
account = plex_account
|
||||
devices = account.devices()
|
||||
for device in devices:
|
||||
name = device.name or 'Unknown'
|
||||
connections = ', '.join(device.connections) if device.connections else 'None'
|
||||
log(2, '%s (%s): %s' % (name, device.product, connections))
|
||||
print('%s (%s): %s' % (name, device.product, connections))
|
||||
assert devices, 'No devices found for account: %s' % account.name
|
||||
|
||||
|
||||
@register()
|
||||
def test_myplex_users(account, plex):
|
||||
users = account.users()
|
||||
assert users, 'Found no users on account: %s' % account.name
|
||||
log(2, 'Found %s users.' % len(users))
|
||||
user = account.user('sdfsdfplex')
|
||||
log(2, 'Found user: %s' % user)
|
||||
assert users, 'Could not find user sdfsdfplex'
|
||||
|
||||
|
||||
@register()
|
||||
def test_myplex_connect_to_device(account, plex):
|
||||
assert account, 'Must specify username, password & resource to run this test.'
|
||||
#@pytest.mark.req_client # this need to be recorded?
|
||||
def _test_myplex_connect_to_device(plex_account):
|
||||
account = plex_account
|
||||
devices = account.devices()
|
||||
for device in devices:
|
||||
if device.name == CONFIG.client and len(device.connections):
|
||||
if device.name == 'some client name' and len(device.connections):
|
||||
break
|
||||
client = device.connect()
|
||||
log(2, 'Connected to client: %s (%s)' % (client.title, client.product))
|
||||
assert client, 'Unable to connect to device'
|
||||
|
||||
|
||||
def test_myplex_users(plex_account):
|
||||
account = plex_account
|
||||
users = account.users()
|
||||
assert users, 'Found no users on account: %s' % account.name
|
||||
print('Found %s users.' % len(users))
|
||||
user = account.user('Hellowlol')
|
||||
print('Found user: %s' % user)
|
||||
assert user, 'Could not find user Hellowlol'
|
||||
|
|
|
@ -1,65 +1,37 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from utils import log, register
|
||||
from plexapi import CONFIG
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
# TODO: test_navigation/test_navigate_to_movie
|
||||
# FAIL: (500) internal_server_error
|
||||
# @register()
|
||||
def test_navigate_to_movie(account, plex):
|
||||
result_library = plex.library.get(CONFIG.movie_title)
|
||||
result_movies = plex.library.section(CONFIG.movie_section).get(CONFIG.movie_title)
|
||||
log(2, 'Navigating to: %s' % CONFIG.movie_title)
|
||||
log(2, 'Result Library: %s' % result_library)
|
||||
log(2, 'Result Movies: %s' % result_movies)
|
||||
assert result_movies, 'Movie navigation not working.'
|
||||
assert result_library == result_movies, 'Movie navigation not consistent.'
|
||||
|
||||
|
||||
@register()
|
||||
def test_navigate_to_show(account, plex):
|
||||
result_shows = plex.library.section(CONFIG.show_section).get(CONFIG.show_title)
|
||||
log(2, 'Navigating to: %s' % CONFIG.show_title)
|
||||
log(2, 'Result Shows: %s' % result_shows)
|
||||
assert result_shows, 'Show navigation not working.'
|
||||
|
||||
|
||||
# TODO: Fix test_navigation/test_navigate_around_show
|
||||
# FAIL: Unable to list season: Season 1
|
||||
# @register()
|
||||
def test_navigate_around_show(account, plex):
|
||||
show = plex.library.section(CONFIG.show_section).get(CONFIG.show_title)
|
||||
def test_navigate_around_show(plex_account, pms):
|
||||
show = pms.library.section('TV Shows').get('The 100')
|
||||
seasons = show.seasons()
|
||||
season = show.season(CONFIG.show_season)
|
||||
season = show.season('Season 1')
|
||||
|
||||
episodes = show.episodes()
|
||||
episode = show.episode(CONFIG.show_episode)
|
||||
log(2, 'Navigating around show: %s' % show)
|
||||
log(2, 'Seasons: %s...' % seasons[:3])
|
||||
log(2, 'Season: %s' % season)
|
||||
log(2, 'Episodes: %s...' % episodes[:3])
|
||||
log(2, 'Episode: %s' % episode)
|
||||
assert CONFIG.show_season in [s.title for s in seasons], 'Unable to list season: %s' % CONFIG.show_season
|
||||
assert CONFIG.show_episode in [e.title for e in episodes], 'Unable to list episode: %s' % CONFIG.show_episode
|
||||
assert show.season(CONFIG.show_season) == season, 'Unable to get show season: %s' % CONFIG.show_season
|
||||
assert show.episode(CONFIG.show_episode) == episode, 'Unable to get show episode: %s' % CONFIG.show_episode
|
||||
assert season.episode(CONFIG.show_episode) == episode, 'Unable to get season episode: %s' % CONFIG.show_episode
|
||||
episode = show.episode('Pilot')
|
||||
|
||||
assert 'Season 1' in [s.title for s in seasons], 'Unable to list season:'
|
||||
assert 'Pilot' in [e.title for e in episodes], 'Unable to list episode:'
|
||||
assert show.season(1) == season
|
||||
assert show.episode('Pilot') == episode, 'Unable to get show episode:'
|
||||
assert season.episode('Pilot') == episode, 'Unable to get season episode:'
|
||||
assert season.show() == show, 'season.show() doesnt match expected show.'
|
||||
assert episode.show() == show, 'episode.show() doesnt match expected show.'
|
||||
assert episode.season() == season, 'episode.season() doesnt match expected season.'
|
||||
|
||||
|
||||
@register()
|
||||
def test_navigate_around_artist(account, plex):
|
||||
artist = plex.library.section(CONFIG.audio_section).get(CONFIG.audio_artist)
|
||||
def _test_navigate_around_artist(plex_account, pms):
|
||||
artist = pms.library.section(CONFIG.audio_section).get(CONFIG.audio_artist)
|
||||
albums = artist.albums()
|
||||
album = artist.album(CONFIG.audio_album)
|
||||
tracks = artist.tracks()
|
||||
track = artist.track(CONFIG.audio_track)
|
||||
log(2, 'Navigating around artist: %s' % artist)
|
||||
log(2, 'Albums: %s...' % albums[:3])
|
||||
log(2, 'Album: %s' % album)
|
||||
log(2, 'Tracks: %s...' % tracks[:3])
|
||||
log(2, 'Track: %s' % track)
|
||||
print('Navigating around artist: %s' % artist)
|
||||
print('Albums: %s...' % albums[:3])
|
||||
print('Album: %s' % album)
|
||||
print('Tracks: %s...' % tracks[:3])
|
||||
print('Track: %s' % track)
|
||||
assert CONFIG.audio_album in [a.title for a in albums], 'Unable to list album: %s' % CONFIG.audio_album
|
||||
assert CONFIG.audio_track in [e.title for e in tracks], 'Unable to list track: %s' % CONFIG.audio_track
|
||||
assert artist.album(CONFIG.audio_album) == album, 'Unable to get artist album: %s' % CONFIG.audio_album
|
||||
|
|
|
@ -1,95 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from utils import log, register
|
||||
from plexapi import CONFIG
|
||||
# test search.
|
||||
|
||||
|
||||
@register()
|
||||
def test_search_show(account, plex):
|
||||
result_server = plex.search(CONFIG.show_title)
|
||||
result_shows = plex.library.section(CONFIG.show_section).search(CONFIG.show_title)
|
||||
result_movies = plex.library.section(CONFIG.movie_section).search(CONFIG.show_title)
|
||||
log(2, 'Searching for: %s' % CONFIG.show_title)
|
||||
log(4, 'Result Server: %s' % result_server)
|
||||
log(4, 'Result Shows: %s' % result_shows)
|
||||
log(4, 'Result Movies: %s' % result_movies)
|
||||
assert result_server, 'Show not found.'
|
||||
assert result_server == result_shows, 'Show searches not consistent.'
|
||||
assert not result_movies, 'Movie search returned show title.'
|
||||
|
||||
|
||||
@register()
|
||||
def test_search_with_apostrophe(account, plex):
|
||||
show_title = "Marvel's Daredevil" # Test ' in show title
|
||||
result_server = plex.search(show_title)
|
||||
result_shows = plex.library.section(CONFIG.show_section).search(show_title)
|
||||
log(2, 'Searching for: %s' % CONFIG.show_title)
|
||||
log(4, 'Result Server: %s' % result_server)
|
||||
log(4, 'Result Shows: %s' % result_shows)
|
||||
assert result_server, 'Show not found.'
|
||||
assert result_server == result_shows, 'Show searches not consistent.'
|
||||
|
||||
|
||||
@register()
|
||||
def test_search_movie(account, plex):
|
||||
result_server = plex.search(CONFIG.movie_title)
|
||||
result_library = plex.library.search(CONFIG.movie_title)
|
||||
result_shows = plex.library.section(CONFIG.show_section).search(CONFIG.movie_title)
|
||||
result_movies = plex.library.section(CONFIG.movie_section).search(CONFIG.movie_title)
|
||||
log(2, 'Searching for: %s' % CONFIG.movie_title)
|
||||
log(4, 'Result Server: %s' % result_server)
|
||||
log(4, 'Result Library: %s' % result_library)
|
||||
log(4, 'Result Shows: %s' % result_shows)
|
||||
log(4, 'Result Movies: %s' % result_movies)
|
||||
assert result_server, 'Movie not found.'
|
||||
assert result_server == result_library == result_movies, 'Movie searches not consistent.'
|
||||
assert not result_shows, 'Show search returned show title.'
|
||||
|
||||
|
||||
@register()
|
||||
def test_search_audio(account, plex):
|
||||
result_server = plex.search(CONFIG.audio_artist)
|
||||
result_library = plex.library.search(CONFIG.audio_artist)
|
||||
result_music = plex.library.section(CONFIG.audio_section).search(CONFIG.audio_artist)
|
||||
log(2, 'Searching for: %s' % CONFIG.audio_artist)
|
||||
log(4, 'Result Server: %s' % result_server)
|
||||
log(4, 'Result Library: %s' % result_library)
|
||||
log(4, 'Result Music: %s' % result_music)
|
||||
assert result_server, 'Artist not found.'
|
||||
assert result_server == result_library == result_music, 'Audio searches not consistent.'
|
||||
|
||||
|
||||
@register()
|
||||
def test_search_related(account, plex):
|
||||
movies = plex.library.section(CONFIG.movie_section)
|
||||
movie = movies.get(CONFIG.movie_title)
|
||||
related_by_actors = movies.search(actor=movie.actors, maxresults=3)
|
||||
log(2, u'Actors: %s..' % movie.actors)
|
||||
log(2, u'Related by Actors: %s..' % related_by_actors)
|
||||
assert related_by_actors, 'No related movies found by actor.'
|
||||
related_by_genre = movies.search(genre=movie.genres, maxresults=3)
|
||||
log(2, u'Genres: %s..' % movie.genres)
|
||||
log(2, u'Related by Genre: %s..' % related_by_genre)
|
||||
assert related_by_genre, 'No related movies found by genre.'
|
||||
related_by_director = movies.search(director=movie.directors, maxresults=3)
|
||||
log(2, 'Directors: %s..' % movie.directors)
|
||||
log(2, 'Related by Director: %s..' % related_by_director)
|
||||
assert related_by_director, 'No related movies found by director.'
|
||||
|
||||
|
||||
# TODO: Fix test_search/test_crazy_search
|
||||
# FAIL: Unable to search movie by director.
|
||||
# @register()
|
||||
def test_crazy_search(account, plex):
|
||||
movies = plex.library.section(CONFIG.movie_section)
|
||||
movie = movies.get('Jurassic World')
|
||||
log(2, u'Search by Actor: "Chris Pratt"')
|
||||
assert movie in movies.search(actor='Chris Pratt'), 'Unable to search movie by actor.'
|
||||
log(2, u'Search by Director: ["Trevorrow"]')
|
||||
assert movie in movies.search(director=['Trevorrow']), 'Unable to search movie by director.'
|
||||
log(2, u'Search by Year: ["2014", "2015"]')
|
||||
assert movie in movies.search(year=['2014', '2015']), 'Unable to search movie by year.'
|
||||
log(2, u'Filter by Year: 2014')
|
||||
assert movie not in movies.search(year=2014), 'Unable to filter movie by year.'
|
||||
judy = [a for a in movie.actors if 'Judy' in a.tag][0]
|
||||
log(2, u'Search by Unpopular Actor: %s' % judy)
|
||||
assert movie in movies.search(actor=judy.id), 'Unable to filter movie by year.'
|
||||
# Many more tests is for search later.
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
import sys
|
||||
import os
|
||||
|
||||
|
||||
plexapi_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
sys.path.insert(0, plexapi_path)
|
|
@ -1,20 +0,0 @@
|
|||
def test_mark_movie_watched(a_movie):
|
||||
a_movie.markUnwatched()
|
||||
print('Marking movie watched: %s' % a_movie)
|
||||
print('View count: %s' % a_movie.viewCount)
|
||||
a_movie.markWatched()
|
||||
print('View count: %s' % a_movie.viewCount)
|
||||
assert a_movie.viewCount == 1, 'View count 0 after watched.'
|
||||
a_movie.markUnwatched()
|
||||
print('View count: %s' % a_movie.viewCount)
|
||||
assert a_movie.viewCount == 0, 'View count 1 after unwatched.'
|
||||
|
||||
|
||||
def test_refresh_section(pms):
|
||||
shows = pms.library.section('TV Shows')
|
||||
#shows.refresh()
|
||||
|
||||
|
||||
def test_refresh_video(pms):
|
||||
result = pms.search('16 blocks')
|
||||
#result[0].refresh()
|
|
@ -1,173 +0,0 @@
|
|||
import pytest
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient__loadData(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_connect(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_contextMenu(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_goBack(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_goToHome(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_goToMedia(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_goToMusic(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_headers(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_isPlayingMedia(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_moveDown(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_moveLeft(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_moveRight(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_moveUp(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_nextLetter(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_pageDown(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_pageUp(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_pause(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_play(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_playMedia(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_previousLetter(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_proxyThroughServer(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_query(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_refreshPlayQueue(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_seekTo(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_select(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_sendCommand(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_setAudioStream(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_setParameters(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_setRepeat(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_setShuffle(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_setStreams(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_setSubtitleStream(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_setVideoStream(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_setVolume(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_skipNext(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_skipPrevious(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_skipTo(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_stepBack(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_stepForward(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_stop(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_timeline(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_toggleOSD(pms):
|
||||
pass
|
||||
|
||||
@pytest.mark.req_client
|
||||
def _test_client_PlexClient_url(pms):
|
||||
pass
|
|
@ -1,78 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
|
||||
|
||||
def test_myplex_accounts(plex_account, pms):
|
||||
account = plex_account
|
||||
assert account, 'Must specify username, password & resource to run this test.'
|
||||
print('MyPlexAccount:')
|
||||
print('username: %s' % account.username)
|
||||
#print('authenticationToken: %s' % account.authenticationToken)
|
||||
print('email: %s' % account.email)
|
||||
print('home: %s' % account.home)
|
||||
print('queueEmail: %s' % account.queueEmail)
|
||||
assert account.username, 'Account has no username'
|
||||
assert account.authenticationToken, 'Account has no authenticationToken'
|
||||
assert account.email, 'Account has no email'
|
||||
assert account.home is not None, 'Account has no home'
|
||||
assert account.queueEmail, 'Account has no queueEmail'
|
||||
account = pms.account()
|
||||
print('Local PlexServer.account():')
|
||||
print('username: %s' % account.username)
|
||||
print('authToken: %s' % account.authToken)
|
||||
print('signInState: %s' % account.signInState)
|
||||
assert account.username, 'Account has no username'
|
||||
assert account.authToken, 'Account has no authToken'
|
||||
assert account.signInState, 'Account has no signInState'
|
||||
|
||||
|
||||
def test_myplex_resources(plex_account):
|
||||
account = plex_account
|
||||
assert account, 'Must specify username, password & resource to run this test.'
|
||||
resources = account.resources()
|
||||
for resource in resources:
|
||||
name = resource.name or 'Unknown'
|
||||
connections = [c.uri for c in resource.connections]
|
||||
connections = ', '.join(connections) if connections else 'None'
|
||||
print('%s (%s): %s' % (name, resource.product, connections))
|
||||
assert resources, 'No resources found for account: %s' % account.name
|
||||
|
||||
|
||||
def test_myplex_connect_to_resource(plex_account):
|
||||
for resource in plex_account.resources():
|
||||
if resource.name == 'PMS_API_TEST_SERVER':
|
||||
break
|
||||
server = resource.connect()
|
||||
assert 'Ohno' in server.url('Ohno')
|
||||
assert server
|
||||
|
||||
|
||||
def test_myplex_devices(plex_account):
|
||||
account = plex_account
|
||||
devices = account.devices()
|
||||
for device in devices:
|
||||
name = device.name or 'Unknown'
|
||||
connections = ', '.join(device.connections) if device.connections else 'None'
|
||||
print('%s (%s): %s' % (name, device.product, connections))
|
||||
assert devices, 'No devices found for account: %s' % account.name
|
||||
|
||||
|
||||
#@pytest.mark.req_client # this need to be recorded?
|
||||
def _test_myplex_connect_to_device(plex_account):
|
||||
account = plex_account
|
||||
devices = account.devices()
|
||||
for device in devices:
|
||||
if device.name == 'some client name' and len(device.connections):
|
||||
break
|
||||
client = device.connect()
|
||||
assert client, 'Unable to connect to device'
|
||||
|
||||
|
||||
def test_myplex_users(plex_account):
|
||||
account = plex_account
|
||||
users = account.users()
|
||||
assert users, 'Found no users on account: %s' % account.name
|
||||
print('Found %s users.' % len(users))
|
||||
user = account.user('Hellowlol')
|
||||
print('Found user: %s' % user)
|
||||
assert user, 'Could not find user Hellowlol'
|
|
@ -1,42 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def test_navigate_around_show(plex_account, pms):
|
||||
show = pms.library.section('TV Shows').get('The 100')
|
||||
seasons = show.seasons()
|
||||
season = show.season('Season 1')
|
||||
|
||||
episodes = show.episodes()
|
||||
episode = show.episode('Pilot')
|
||||
|
||||
assert 'Season 1' in [s.title for s in seasons], 'Unable to list season:'
|
||||
assert 'Pilot' in [e.title for e in episodes], 'Unable to list episode:'
|
||||
assert show.season(1) == season
|
||||
assert show.episode('Pilot') == episode, 'Unable to get show episode:'
|
||||
assert season.episode('Pilot') == episode, 'Unable to get season episode:'
|
||||
assert season.show() == show, 'season.show() doesnt match expected show.'
|
||||
assert episode.show() == show, 'episode.show() doesnt match expected show.'
|
||||
assert episode.season() == season, 'episode.season() doesnt match expected season.'
|
||||
|
||||
|
||||
def _test_navigate_around_artist(plex_account, pms):
|
||||
artist = pms.library.section(CONFIG.audio_section).get(CONFIG.audio_artist)
|
||||
albums = artist.albums()
|
||||
album = artist.album(CONFIG.audio_album)
|
||||
tracks = artist.tracks()
|
||||
track = artist.track(CONFIG.audio_track)
|
||||
print('Navigating around artist: %s' % artist)
|
||||
print('Albums: %s...' % albums[:3])
|
||||
print('Album: %s' % album)
|
||||
print('Tracks: %s...' % tracks[:3])
|
||||
print('Track: %s' % track)
|
||||
assert CONFIG.audio_album in [a.title for a in albums], 'Unable to list album: %s' % CONFIG.audio_album
|
||||
assert CONFIG.audio_track in [e.title for e in tracks], 'Unable to list track: %s' % CONFIG.audio_track
|
||||
assert artist.album(CONFIG.audio_album) == album, 'Unable to get artist album: %s' % CONFIG.audio_album
|
||||
assert artist.track(CONFIG.audio_track) == track, 'Unable to get artist track: %s' % CONFIG.audio_track
|
||||
assert album.track(CONFIG.audio_track) == track, 'Unable to get album track: %s' % CONFIG.audio_track
|
||||
assert album.artist() == artist, 'album.artist() doesnt match expected artist.'
|
||||
assert track.artist() == artist, 'track.artist() doesnt match expected artist.'
|
||||
assert track.album() == album, 'track.album() doesnt match expected album.'
|
|
@ -1,3 +0,0 @@
|
|||
# test search.
|
||||
|
||||
# Many more tests is for search later.
|
Loading…
Reference in a new issue