Skip to content

Commit da82cc0

Browse files
author
Graham Thompson
committed
Added test for use of maxresults in fetchItems pushingkarmaorg#1393
1 parent 7853d81 commit da82cc0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Diff for: tests/test_library.py

+15
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,21 @@ def test_library_fetchItem(plex, movie):
120120
assert item1 == item2 == movie
121121

122122

123+
def test_library_fetchItems_with_maxresults(plex):
124+
items1 = plex.library.search(libtype="episode")
125+
assert len(items1) > 5
126+
size = len(items1) - 5
127+
ids = [item.key for item in items1]
128+
# Reduce '/library/metadata/123' to '123'
129+
int_ids = [int(id.rsplit("/", 1)[-1]) for id in ids]
130+
items2 = [item.key for item in plex.library.fetchItems(container_size=size, ekey=int_ids)]
131+
items3 = [item.key for item in plex.library.fetchItems(
132+
container_size=size, ekey=int_ids, maxresults=len(int_ids)
133+
)]
134+
assert len(items2) == len(set(items2))
135+
assert len(items3) == len(set(items3))
136+
137+
123138
def test_library_onDeck(plex, movie):
124139
movie.updateProgress(movie.duration // 4) # set progress to 25%
125140
assert movie in plex.library.onDeck()

0 commit comments

Comments
 (0)