Skip to content

Commit

Permalink
Added test for use of maxresults in fetchItems pkkid#1393
Browse files Browse the repository at this point in the history
  • Loading branch information
Graham Thompson committed Apr 9, 2024
1 parent 7853d81 commit da82cc0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,21 @@ def test_library_fetchItem(plex, movie):
assert item1 == item2 == movie


def test_library_fetchItems_with_maxresults(plex):
items1 = plex.library.search(libtype="episode")
assert len(items1) > 5
size = len(items1) - 5
ids = [item.key for item in items1]
# Reduce '/library/metadata/123' to '123'
int_ids = [int(id.rsplit("/", 1)[-1]) for id in ids]
items2 = [item.key for item in plex.library.fetchItems(container_size=size, ekey=int_ids)]
items3 = [item.key for item in plex.library.fetchItems(
container_size=size, ekey=int_ids, maxresults=len(int_ids)
)]
assert len(items2) == len(set(items2))
assert len(items3) == len(set(items3))


def test_library_onDeck(plex, movie):
movie.updateProgress(movie.duration // 4) # set progress to 25%
assert movie in plex.library.onDeck()
Expand Down

0 comments on commit da82cc0

Please sign in to comment.