def setUpClass(cls): library.scraper.getshowinfo = fake_getshowinfo library.scraper.getinfodict = fake_getepinfo library.scraper.getepisodes = fake_getepisodes_return_A cls.show = library.Show(urlid="faketvshowurlid", title="The Fake Koala %s Show" % const.provider) cls.episodepath = uni_join(const.libpath, "%s shows" % const.provider, "%s\\" % stringtofile(cls.show.title)) library.execute(to_update_add=[cls.show])
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)
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
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])
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])
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)
def setUpClass(cls): library.scraper.getepisodes = fake_getepisodes_return_A_B cls.show = library.Show(urlid="mr-selfridge", title="Mr. Selfridge") library.execute(to_update_add=[cls.show])
def setUpClass(cls): library.scraper.getinfodict = fake_getmovieinfo cls.movie = library.Movie(urlid="/program/fakemovieurlid/the-fake-movie", title="The Fake Koala %s Movie" % const.provider) library.execute(to_update_add=[cls.movie])
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])
def setUpClass(cls): cls.movie = library.Movie(urlid="/program/KOIF10009214/we-dont-live-here-anymore", title="We Don't Live Here Anymore") library.execute(to_update_add=[cls.movie])