Skip to content

Commit baf655b

Browse files
committed
add split, unmatch, stop, installupdate
1 parent 0cc573b commit baf655b

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

plexapi/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@
3535
logformat = CONFIG.get('log.format', '%(asctime)s %(module)12s:%(lineno)-4s %(levelname)-9s %(message)s')
3636
loglevel = CONFIG.get('log.level', 'INFO').upper()
3737
loghandler = logging.NullHandler()
38-
if logfile:
38+
39+
if logfile: # pragma: no cover
3940
logbackups = CONFIG.get('log.backup_count', 3, int)
4041
logbytes = CONFIG.get('log.rotate_bytes', 512000, int)
4142
loghandler = RotatingFileHandler(os.path.expanduser(logfile), 'a', logbytes, logbackups)
43+
4244
loghandler.setFormatter(logging.Formatter(logformat))
4345
log.addHandler(loghandler)
4446
log.setLevel(loglevel)

tests/test_server.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,14 @@ def test_server_sessions(plex):
165165

166166

167167
def test_server_isLatest(plex, mocker):
168-
# I really need to update the testservers pms.. TODO
169-
with mocker.patch('plexapi.server.PlexServer.isLatest', return_value=True):
170-
assert plex.isLatest() is True
168+
plex.isLatest()
169+
170+
171+
def test_server_installUpdate(plex, mocker):
172+
m = mocker.MagicMock(release='aa')
173+
mocker.patch('plexapi.server.PlexServer.check_for_update', return_value=m)
174+
with utils.callable_http_patch():
175+
plex.installUpdate()
171176

172177

173178
def test_server_check_for_update(plex, mocker):

tests/test_video.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,19 @@ def test_video_Show(show):
271271
assert show.title == 'Game of Thrones'
272272

273273

274+
def test_video_Episode_split(episode, patched_http_call):
275+
episode.split()
276+
277+
278+
def test_video_Episode_unmatch(episode, patched_http_call):
279+
episode.unmatch()
280+
281+
282+
def test_video_Episode_stop(episode, mocker, patched_http_call):
283+
mocker.patch.object(episode, 'session', return_value=list(mocker.MagicMock(id='hello')))
284+
episode.stop(reason="It's past bedtime!")
285+
286+
274287
def test_video_Show_attrs(show):
275288
assert utils.is_datetime(show.addedAt)
276289
assert utils.is_metadata(show.art, contains='/art/')

0 commit comments

Comments
 (0)