add split, unmatch, stop, installupdate

This commit is contained in:
Hellowlol 2017-10-29 00:40:35 +02:00
parent 0cc573b477
commit baf655b88b
3 changed files with 24 additions and 4 deletions

View file

@ -35,10 +35,12 @@ logfile = CONFIG.get('log.path')
logformat = CONFIG.get('log.format', '%(asctime)s %(module)12s:%(lineno)-4s %(levelname)-9s %(message)s')
loglevel = CONFIG.get('log.level', 'INFO').upper()
loghandler = logging.NullHandler()
if logfile:
if logfile: # pragma: no cover
logbackups = CONFIG.get('log.backup_count', 3, int)
logbytes = CONFIG.get('log.rotate_bytes', 512000, int)
loghandler = RotatingFileHandler(os.path.expanduser(logfile), 'a', logbytes, logbackups)
loghandler.setFormatter(logging.Formatter(logformat))
log.addHandler(loghandler)
log.setLevel(loglevel)

View file

@ -165,9 +165,14 @@ def test_server_sessions(plex):
def test_server_isLatest(plex, mocker):
# I really need to update the testservers pms.. TODO
with mocker.patch('plexapi.server.PlexServer.isLatest', return_value=True):
assert plex.isLatest() is True
plex.isLatest()
def test_server_installUpdate(plex, mocker):
m = mocker.MagicMock(release='aa')
mocker.patch('plexapi.server.PlexServer.check_for_update', return_value=m)
with utils.callable_http_patch():
plex.installUpdate()
def test_server_check_for_update(plex, mocker):

View file

@ -271,6 +271,19 @@ def test_video_Show(show):
assert show.title == 'Game of Thrones'
def test_video_Episode_split(episode, patched_http_call):
episode.split()
def test_video_Episode_unmatch(episode, patched_http_call):
episode.unmatch()
def test_video_Episode_stop(episode, mocker, patched_http_call):
mocker.patch.object(episode, 'session', return_value=list(mocker.MagicMock(id='hello')))
episode.stop(reason="It's past bedtime!")
def test_video_Show_attrs(show):
assert utils.is_datetime(show.addedAt)
assert utils.is_metadata(show.art, contains='/art/')