class PPPrivateTests(test_lib.SickbeardTestDBCase): def setUp(self): super(PPPrivateTests, self).setUp() sickbeard.showList = [TVShow(0000), TVShow(0001)] self.pp = PostProcessor(test_lib.FILEPATH) self.show_obj = TVShow(0002) self.db = test_lib.db.DBConnection() newValueDict = { "tvdbid": 1002, "name": test_lib.SHOWNAME, "description": "description", "airdate": 1234, "hasnfo": 1, "hastbn": 1, "status": 404, "location": test_lib.FILEPATH } controlValueDict = { "showid": 0002, "season": test_lib.SEASON, "episode": test_lib.EPISODE } # use a custom update/insert method to get the data into the DB self.db.upsert("tv_episodes", newValueDict, controlValueDict) self.ep_obj = TVEpisode(self.show_obj, test_lib.SEASON, test_lib.EPISODE, test_lib.FILEPATH) def test__find_ep_destination_folder(self): self.show_obj.location = test_lib.FILEDIR self.ep_obj.show.seasonfolders = 1 sickbeard.SEASON_FOLDERS_FORMAT = 'Season %02d' calculatedPath = self.pp._find_ep_destination_folder(self.ep_obj) ecpectedPath = os.path.join(test_lib.FILEDIR, "Season 0" + str(test_lib.SEASON)) self.assertEqual(calculatedPath, ecpectedPath)
class PPPrivateTests(test.SickbeardTestDBCase): def setUp(self): super(PPPrivateTests, self).setUp() sickbeard.showList = [TVShow(0000), TVShow(0001)] self.pp = PostProcessor(test.FILEPATH) self.show_obj = TVShow(0002) self.db = test.db.DBConnection() newValueDict = {"tvdbid": 1002, "name": test.SHOWNAME, "description": "description", "airdate": 1234, "hasnfo": 1, "hastbn": 1, "status": 404, "location": test.FILEPATH} controlValueDict = {"showid": 0002, "season": test.SEASON, "episode": test.EPISODE} # use a custom update/insert method to get the data into the DB self.db.upsert("tv_episodes", newValueDict, controlValueDict) self.ep_obj = TVEpisode(self.show_obj, test.SEASON, test.EPISODE, test.FILEPATH) def tearDown(self): self.db.close() def test__find_ep_destination_folder(self): self.show_obj.location = test.FILEDIR self.ep_obj.show.seasonfolders = 1 sickbeard.SEASON_FOLDERS_FORMAT = 'Season %02d' calculatedPath = self.pp._find_ep_destination_folder(self.ep_obj) ecpectedPath = os.path.join(test.FILEDIR, "Season 0" + str(test.SEASON)) self.assertEqual(calculatedPath, ecpectedPath)