def test_get_episode(): show = Series(1, 1, "en") show.name = "show name" show.network = "cbs" show.genre = "crime" show.runtime = 40 show.status = "Ended" show.default_ep_status = "5" show.airs = "monday" show.start_year = 1987 show.save_to_db() app.showList = [show]
def test_process(self): show = Series(1, 3) show.name = test.SHOW_NAME show.location = test.SHOW_DIR show.save_to_db() app.showList = [show] episode = Episode(show, test.SEASON, test.EPISODE) episode.name = "some episode name" episode.save_to_db() addNameToCache('show name', 3) app.PROCESS_METHOD = 'move' post_processor = PostProcessor(test.FILE_PATH) self.assertTrue(post_processor.process())
def test_change_indexerid(self): show = Series(1, 1, "en") show.name = "show name" show.network = "cbs" show.genre = "crime" show.runtime = 40 show.status = "Ended" show.default_ep_status = "5" show.airs = "monday" show.start_year = 1987 show.save_to_db() show._load_from_db() show.indexerid = 2 show.save_to_db() show._load_from_db() self.assertEqual(show.indexerid, 2)
def do_test(): """Test to perform.""" global search_items # pylint: disable=global-statement search_items = cur_data["i"] show = Series(1, tvdb_id) show.name = show_name show.quality = cur_data["q"] show.save_to_db() app.showList.append(show) episode = None for epNumber in cur_data["e"]: episode = Episode(show, cur_data["s"], epNumber) episode.status = common.WANTED episode.save_to_db() best_result = search_providers(show, episode.episode, force_search) if not best_result: assert cur_data["b"] == best_result # pylint: disable=no-member assert cur_data["b"] == best_result.name # first is expected, second is chosen one
def setUpClass(cls): """Set up class for tests.""" num_legacy_shows = 3 num_shows = 3 num_episodes_per_show = 5 cls.mydb = db.DBConnection() cls.legacy_shows = [] cls.shows = [] # Per-show-notifications were originally added for email notifications only. To add # this feature to other notifiers, it was necessary to alter the way text is stored in # one of the DB columns. Therefore, to test properly, we must create some shows that # store emails in the old method (legacy method) and then other shows that will use # the new method. for show_counter in range(100, 100 + num_legacy_shows): show = Series(1, show_counter) show.name = "Show " + str(show_counter) show.episodes = [] for episode_counter in range(0, num_episodes_per_show): episode = Episode(show, test.SEASON, episode_counter) episode.name = "Episode " + str(episode_counter + 1) episode.quality = "SDTV" show.episodes.append(episode) show.save_to_db() cls.legacy_shows.append(show) for show_counter in range(200, 200 + num_shows): show = Series(1, show_counter) show.name = "Show " + str(show_counter) show.episodes = [] for episode_counter in range(0, num_episodes_per_show): episode = Episode(show, test.SEASON, episode_counter) episode.name = "Episode " + str(episode_counter + 1) episode.quality = "SDTV" show.episodes.append(episode) show.save_to_db() cls.shows.append(show)
def setUpClass(cls): """Set up class for tests.""" num_legacy_shows = 3 num_shows = 3 num_episodes_per_show = 5 cls.mydb = db.DBConnection() cls.legacy_shows = [] cls.shows = [] # Per-show-notifications were originally added for email notifications only. To add # this feature to other notifiers, it was necessary to alter the way text is stored in # one of the DB columns. Therefore, to test properly, we must create some shows that # store emails in the old method (legacy method) and then other shows that will use # the new method. for show_counter in list(range(100, 100 + num_legacy_shows)): show = Series(1, show_counter) show.name = "Show " + text_type(show_counter) show.episodes = [] for episode_counter in list(range(0, num_episodes_per_show)): episode = Episode(show, test.SEASON, episode_counter) episode.name = "Episode " + text_type(episode_counter + 1) episode.quality = "SDTV" show.episodes.append(episode) show.save_to_db() cls.legacy_shows.append(show) for show_counter in list(range(200, 200 + num_shows)): show = Series(1, show_counter) show.name = "Show " + text_type(show_counter) show.episodes = [] for episode_counter in list(range(0, num_episodes_per_show)): episode = Episode(show, test.SEASON, episode_counter) episode.name = "Episode " + text_type(episode_counter + 1) episode.quality = "SDTV" show.episodes.append(episode) show.save_to_db() cls.shows.append(show)
def test_set_name(self): show = Series(1, 1, "en") show.name = "newName" show.save_to_db() show._load_from_db() self.assertEqual(show.name, "newName")