Rename tools to follow naming pattern

This commit is contained in:
Michael Shepanski 2017-04-27 21:21:40 -04:00
parent 9cf46f0e23
commit 109d7367f6
7 changed files with 38 additions and 9 deletions

View file

@ -55,7 +55,7 @@ class PlexClient(PlexObject):
TAG = 'Player'
key = '/resources'
def __init__(self, server=None, data=None, initpath=None, baseurl=None, token=None, session=None, timeout=None):
def __init__(self, server=None, data=None, initpath=None, baseurl=None, token=None, connect=True, session=None, timeout=None):
super(PlexClient, self).__init__(server, data, initpath)
self._baseurl = baseurl.strip('/') if baseurl else None
self._token = logfilter.add_secret(token)
@ -66,7 +66,7 @@ class PlexClient(PlexObject):
if not any([data, initpath, baseurl, token]):
self._baseurl = CONFIG.get('auth.client_baseurl', 'http://localhost:32433')
self._token = logfilter.add_secret(CONFIG.get('auth.client_token'))
if self._baseurl:
if connect and self._baseurl:
self.connect(timeout=timeout)
def connect(self, timeout=None):

View file

@ -175,8 +175,7 @@ class PlexServer(PlexObject):
return Account(self, data)
def clients(self):
""" Returns a list of all :class:`~plexapi.client.PlexClient` objects
connected to this server."""
""" Returns list of all :class:`~plexapi.client.PlexClient` objects connected to server. """
items = []
cache_resource = None
from plexapi.myplex import MyPlexResource
@ -195,7 +194,7 @@ class PlexServer(PlexObject):
port = conn.port
break
baseurl = 'http://%s:%s' % (elem.attrib['host'], port)
items.append(PlexClient(baseurl=baseurl, server=self, data=elem))
items.append(PlexClient(baseurl=baseurl, server=self, data=elem, connect=False))
return items
def client(self, name):

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
import pytest
import pytest, time
def test_list_clients(account, plex, client):
def test_list_clients(account, plex):
# List resources from MyPlex
print('\nResources listed on MyPlex')
print('---------------------------')
@ -33,8 +33,38 @@ def test_list_clients(account, plex, client):
@pytest.mark.client
def test_test(client):
print(client)
def test_client_navigation_direct(plex, client, episode, artist):
_navigate(plex, client, episode, artist)
@pytest.mark.client
def test_client_navigation_via_proxy(plex, client, episode, artist):
client.proxyThroughServer()
_navigate(plex, client, episode, artist)
def _navigate(plex, client, episode, artist):
# Browse around a bit..
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
client.goToMedia(episode); time.sleep(5)
client.goToMedia(artist); time.sleep(5)
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.client

View file