mirror of
https://github.com/pkkid/python-plexapi
synced 2025-02-16 12:58:26 +00:00
Fix playlist tests
This commit is contained in:
parent
2765bee2b3
commit
810c5566c3
2 changed files with 7 additions and 4 deletions
|
@ -98,14 +98,14 @@ class Playlist(PlexPartialObject, Playable):
|
|||
title (str): Title of the item to return.
|
||||
"""
|
||||
for item in self.items():
|
||||
if item.title.lower() == title:
|
||||
if item.title.lower() == title.lower():
|
||||
return item
|
||||
raise NotFound('Item with title "%s" not found in the playlist')
|
||||
raise NotFound('Item with title "%s" not found in the playlist' % title)
|
||||
|
||||
def items(self):
|
||||
""" Returns a list of all items in the playlist. """
|
||||
if self._items is None:
|
||||
key = '/playlist/%s/items' % self.ratingKey
|
||||
key = '/playlists/%s/items' % self.ratingKey
|
||||
items = self.fetchItems(key)
|
||||
self._items = items
|
||||
return self._items
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import time
|
||||
|
||||
import pytest
|
||||
from plexapi.exceptions import NotFound
|
||||
|
||||
|
||||
def test_create_playlist(plex, show):
|
||||
|
@ -51,7 +52,7 @@ def test_create_playlist(plex, show):
|
|||
|
||||
|
||||
def test_playlist_item(plex, show):
|
||||
title = 'test_create_playlist_item_show'
|
||||
title = 'test_playlist_item'
|
||||
episodes = show.episodes()
|
||||
try:
|
||||
playlist = plex.createPlaylist(title, episodes[:3])
|
||||
|
@ -60,6 +61,8 @@ def test_playlist_item(plex, show):
|
|||
item2 = playlist.get("Winter Is Coming")
|
||||
assert item2 in playlist.items()
|
||||
assert item1 == item2
|
||||
with pytest.raises(NotFound):
|
||||
playlist.item("Does not exist")
|
||||
finally:
|
||||
playlist.delete()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue