def test_marks_episode_as_do_not_download(self): mockDAL = Mock(spec=DAL.DAL) mockDAL.get_eps_for_show = MagicMock(return_value = {1: [1,2,3,4,5,6,7,8,9,10,11,12]}) spiderbro = spider.spider(mockDAL) spiderbro.config.force_learn = True spiderbro.find_torrents_for_show("Constantine") mockDAL.mark_episode_do_not_download.assert_called_once_with("Constantine", 1, 13, unittest.mock.ANY, unittest.mock.ANY)
def test_can_get_missing_episodes(self): mockDAL = Mock(spec=DAL.DAL) mockDAL.get_eps_for_show = MagicMock(return_value = {1: [1, 2]}) spiderbro = spider.spider(mockDAL) missing_episodes = spiderbro.get_missing_episodes("Life On Mars") self.assertDictEqual(missing_episodes, {1:[3,4,5,6,7,8], 2:[-1]})
def test_updates_show_table(self): mockDAL = Mock(spec=DAL.DAL) mockDAL.get_eps_for_show = MagicMock(return_value = {1: [1, 2]}) spiderbro = spider.spider(mockDAL) missing_episodes = spiderbro.get_missing_episodes("Life On Mars") mockDAL.update_show_table.assert_called_with('Life On Mars')
def test_saves_successful_search_in_database(self): mockDAL = Mock(spec=DAL.DAL) mockDAL.get_eps_for_show = MagicMock(return_value = {1: [1,2,3,4,5,6,7,8,9,10,11,12]}) spiderbro = spider.spider(mockDAL) spiderbro.find_torrents_for_show("Constantine") mockDAL.mark_episode_for_download.assert_called_once_with("Constantine", 1, 13, unittest.mock.ANY, unittest.mock.ANY)
def test_dont_mark_download_whole_season_if_season_not_finished_airing(self): mockDAL = Mock(spec=DAL.DAL) mockDAL.get_eps_for_show = MagicMock(return_value = {}) spiderbro = spider.spider(mockDAL) tvdb_episodes = spiderbro.get_missing_episodes('Orphan Black') self.assertNotEqual(tvdb_episodes[3], [-1])