Ejemplo n.º 1
0
 def test_replace_both_added_episodes(self):
     """Does making getepisodes() return 2 episodes different from the ones in the kodi library cause
      the episodes in the library to be replaced?"""
     stored_episodes_A_B = rpc("VideoLibrary.GetEpisodes",
                               filter={"field": "path", "operator": "startswith", "value": self.show.path}).get('episodes', [])
     stored_episodes_A_B.sort()
     library.scraper.getepisodes = fake_getepisodes_return_C_D
     library.execute(to_update_add=[self.show])
     stored_episodes_C_D = rpc("VideoLibrary.GetEpisodes",
                               filter={"field": "path", "operator": "startswith", "value": self.show.path}).get('episodes', [])
     stored_episodes_C_D.sort()
     # better assertion: there should be no overlap
     self.assertNotEqual(stored_episodes_A_B, stored_episodes_C_D)
Ejemplo n.º 2
0
 def test_add_one_episode_remove_one_episode(self):
     """Does making getepisodes() return one different from one in the kodi library cause
     one episode to be added to the library and one removed?"""
     stored_episodes_A_B = rpc("VideoLibrary.GetEpisodes",
                               filter={"field": "path", "operator": "startswith", "value": self.show.path}).get('episodes', [])
     stored_episodes_A_B.sort()
     library.scraper.getepisodes = fake_getepisodes_return_A_C
     library.execute(to_update_add=[self.show])
     stored_episodes_A_C = rpc("VideoLibrary.GetEpisodes",
                               filter={"field": "path", "operator": "startswith", "value": self.show.path}).get('episodes', [])
     stored_episodes_A_C.sort()
     self.assertEqual(stored_episodes_A_B[0], stored_episodes_A_C[0])
     self.assertNotEqual(stored_episodes_A_B[1], stored_episodes_A_C[1])
Ejemplo n.º 3
0
 def setUp(self):
     library.scraper.getepisodes = fake_getepisodes_return_A_B
     self.show = library.Show(urlid="fader-brown", title="Father Brown")
     library.execute(to_update_add=[self.show])
     stored_episodes = rpc("VideoLibrary.GetEpisodes",
                           filter={"field": "path", "operator": "startswith", "value": self.show.path}).get('episodes', [])
     assert len(stored_episodes) == 2
Ejemplo n.º 4
0
 def test_remove_one_episode(self):
     """Does making getepisodes() return 1 episode cause one episode to be removed from the kodi library?"""
     library.scraper.getepisodes = fake_getepisodes_return_A
     library.execute(to_update_add=[self.show])
     stored_episodes = rpc("VideoLibrary.GetEpisodes",
                           filter={"field": "path", "operator": "startswith", "value": self.show.path}).get('episodes', [])
     self.assertEqual(len(stored_episodes), 1, msg="stored_episodes:\n%s" % stored_episodes)
Ejemplo n.º 5
0
 def setUpClass(cls):
     library.scraper.getepisodes = fake_getepisodes_return_A_B
     cls.show = library.Show(urlid="broadchurch", title="Broadchurch")
     library.execute(to_update_add=[cls.show])
     cls.episodepath = uni_join(const.libpath, "%s shows" % const.provider, "%s\\" % stringtofile(cls.show.title))
     libfiles = [show["file"] for show in rpc("VideoLibrary.GetTVShows", properties=["file"])['tvshows']]
     assert cls.episodepath in libfiles
     library.execute(to_remove=[cls.show])
Ejemplo n.º 6
0
 def test_show_NFO_data_correctly_added(self):
     """Does data stored with fake show in Kodi library correpond with inputed NFO data?"""
     returned_infodict = rpc("VideoLibrary.GetTVShows",
                             properties=["year", "plot", "art"],
                             filter={"field": "title", "operator": "is", "value": "The Fake Koala %s Show" % const.provider})
     returned_infodict = returned_infodict["tvshows"][0]
     excpected_returned_infodict = {
         "title": returned_infodict["label"],
         "year": unicode(returned_infodict["year"]),
         "plot": returned_infodict["plot"],
         "art": unquote_plus(returned_infodict["art"]["poster"].replace("image://", "").lower().rstrip("/")),
         "in_superuniverse": False,
     }
     self.assertEqual(excpected_returned_infodict, fake_show_data, msg="\n%s\n%s" % (excpected_returned_infodict, fake_show_data))
Ejemplo n.º 7
0
 def test_episode_NFO_data_correctly_added(self):
     """Does data stored with fake episde in Kodi library correpond with inputed NFO data?"""
     returned_infodict = rpc("VideoLibrary.GetEpisodes",
                             properties=["showtitle", "season", "episode", "plot", "runtime", "art"],
                             filter={"field": "tvshow", "operator": "is", "value": "The Fake Koala %s Show" % const.provider})
     returned_infodict = returned_infodict['episodes'][0]
     excpected_returned_infodict = {
         "title": returned_infodict["label"].replace("%dx%02d. " % (returned_infodict["season"], returned_infodict["episode"]), ""),
         "showtitle": returned_infodict["showtitle"],
         "season": unicode(returned_infodict["season"]),
         "episode": unicode(returned_infodict["episode"]),
         "plot": returned_infodict["plot"],
         "runtime": unicode(returned_infodict["runtime"]/60),
         "art": unquote_plus(returned_infodict["art"]["thumb"].replace("image://", "").lower().rstrip("/")),
         "in_superuniverse": False,
     }
     self.assertEqual(excpected_returned_infodict, fake_episode_data, msg="\n%s\n%s" % (excpected_returned_infodict, fake_episode_data))
Ejemplo n.º 8
0
 def test_movie_NFO_data_correctly_added(self):
     """Does data stored with fake movie in Kodi library correpond with inputed NFO data?"""
     returned_infodict = rpc("VideoLibrary.GetMovies",
                             properties=["title", "year", "plot", "art", "runtime"],
                             multifilter={"and": [
                                  ("filename", "is", self.movie.htmfilename),
                                  ("path", "startswith", self.movie.path)]})
     returned_infodict = returned_infodict["movies"][0]
     excpected_returned_infodict = {
         "title": returned_infodict["label"],
         "year": str(returned_infodict["year"]),
         "runtime": str(returned_infodict["runtime"]/60),
         "plot": returned_infodict["plot"],
         "art": unquote_plus(returned_infodict["art"]["poster"].replace("image://", "").lower().rstrip("/")),
         "in_superuniverse": False,
     }
     self.assertEqual(excpected_returned_infodict, fake_movie_data, msg="\n%s\n%s" % (excpected_returned_infodict, fake_movie_data))
Ejemplo n.º 9
0
 def test_episode_with_NFO_added_to_kodi_lib(self):
     """Is episode added to kodi library when .nfo created?"""
     stored_episodes = rpc("VideoLibrary.GetEpisodes",
                           filter={"field": "tvshow", "operator": "is", "value": "The Fake Koala %s Show" % const.provider}).get('episodes', [])
     self.assertEqual(len(stored_episodes), 1, msg="stored_episodes:\n%s" % stored_episodes)
Ejemplo n.º 10
0
 def test_show_with_NFO_added_to_kodi_lib(self):
     """Does show.add_update() cause the show to be added to kodi library when .nfo created?"""
     libfiles = [show["file"] for show in rpc("VideoLibrary.GetTVShows", properties=["file"])['tvshows']]
     self.assertIn(self.episodepath, libfiles)
Ejemplo n.º 11
0
 def test_remove_show_from_kodi_lib(self):
     """Does show.remove() cause the show be removed from kodi library?"""
     libfiles = [show["file"] for show in rpc("VideoLibrary.GetTVShows", properties=["file"])['tvshows']]
     self.assertNotIn(self.episodepath, libfiles)
Ejemplo n.º 12
0
 def test_add_show_to_kodi_lib(self):
     """Does show.add_update() cause the show to be added to kodi library?"""
     episodepath = uni_join(const.libpath, "%s shows" % const.provider, "%s\\" % stringtofile(self.show.title))
     libfiles = [show["file"] for show in rpc("VideoLibrary.GetTVShows", properties=["file"])['tvshows']]
     self.assertIn(episodepath, libfiles)
Ejemplo n.º 13
0
 def test_movie_with_NFO_added_to_kodi_lib(self):
     """Does movie.add_update() cause the movie to be added to kodi library when .nfo created?"""
     libfiles = [movie["file"] for movie in rpc("VideoLibrary.GetMovies", properties=["file"])['movies']]
     self.assertIn(uni_join(self.movie.path, self.movie.htmfilename), libfiles)
Ejemplo n.º 14
0
 def test_remove_movie_from_kodi_lib(self):
     """Does movie.remove() cause the movie be removed from kodi library?"""
     libfiles = [movie["file"] for movie in rpc("VideoLibrary.GetMovies", properties=["file"])['movies']]
     self.assertNotIn(self.movie.htmfilename, libfiles)
Ejemplo n.º 15
0
 def setUpClass(cls):
     cls.movie = library.Movie(urlid="/program/KOIF47000608/der-untergang", title="Der Untergang")
     library.execute(to_update_add=[cls.movie])
     libfiles = [movie["file"] for movie in rpc("VideoLibrary.GetMovies", properties=["file"])['movies']]
     assert uni_join(cls.movie.path, cls.movie.htmfilename) in libfiles
     library.execute(to_remove=[cls.movie])