From 47e4c9d2b7fb6d4357fb7dc4b3addcf75393174d Mon Sep 17 00:00:00 2001 From: Hellowlol Date: Sun, 29 Oct 2017 01:29:58 +0200 Subject: [PATCH] more tests --- tests/test_library.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/tests/test_library.py b/tests/test_library.py index 12ce7480..083e0f8a 100644 --- a/tests/test_library.py +++ b/tests/test_library.py @@ -45,13 +45,8 @@ def test_library_section_get_movie(plex): assert plex.library.section('Movies').get('Sita Sings the Blues') -def test_library_section_delete(monkeypatch, movies): - monkeypatch.delattr("requests.sessions.Session.request") - try: - movies.delete() - except AttributeError: - # will always raise because there is no request - pass +def test_library_section_delete(movies, patched_http_call): + movies.delete() def test_library_fetchItem(plex, movie): @@ -69,11 +64,6 @@ def test_library_recentlyAdded(plex): assert len(list(plex.library.recentlyAdded())) -def test_library_search(plex): - item = plex.library.search('Elephants Dream')[0] - assert item.title == 'Elephants Dream' - - def test_library_add_edit_delete(plex): # Dont add a location to prevent scanning scanning section_name = 'plexapi_test_section' @@ -115,14 +105,28 @@ def test_library_Library_deleteMediaPreviews(plex): plex.library.deleteMediaPreviews() -def _test_library_MovieSection_refresh(movies): - movies.refresh() +def test_library_Library_all(plex): + assert len(plex.library.all(title__iexact='The 100')) + + +def test_library_Library_search(plex): + item = plex.library.search('Elephants Dream')[0] + assert item.title == 'Elephants Dream' + assert len(plex.library.search(libtype='episode')) def test_library_MovieSection_update(movies): movies.update() +def test_library_ShowSection_all(tvshows): + assert len(tvshows.all(title__iexact='The 100')) + + +def test_library_MovieSection_refresh(movies, patched_http_call): + movies.refresh() + + def test_library_MovieSection_search_genre(movie, movies): # assert len(movie.genres[0].items()) # TODO assert len(movies.search(genre=movie.genres[0])) > 1