def test_remove_torrent_failed(self): torrent_filename = 'Hell.On.Wheels.S05E02.720p.WEB.rus.LostFilm.TV.mp4.torrent' torrent_filepath = self.get_httpretty_filename(torrent_filename) torrent = Torrent.from_file(torrent_filepath) plugin = DownloaderPlugin() self.assertFalse(plugin.remove_torrent(torrent.info_hash)) settings = {'path': self.downloader_dir} plugin.set_settings(settings) downloaded_filepath = os.path.join(self.downloader_dir, torrent_filename) if not os.path.exists(self.downloader_dir): os.makedirs(self.downloader_dir) shutil.copy(torrent_filepath, downloaded_filepath) with patch('monitorrent.plugins.clients.downloader.os.remove') as remove: remove.side_effect = OSError self.assertFalse(plugin.remove_torrent(torrent.info_hash)) self.assertTrue(os.path.exists(downloaded_filepath))
def test_remove_torrent_failed(self): torrent_filename = 'Hell.On.Wheels.S05E02.720p.WEB.rus.LostFilm.TV.mp4.torrent' torrent_filepath = self.get_httpretty_filename(torrent_filename) torrent = Torrent.from_file(torrent_filepath) plugin = DownloaderPlugin() self.assertFalse(plugin.remove_torrent(torrent.info_hash)) settings = {'path': self.downloader_dir} plugin.set_settings(settings) downloaded_filepath = os.path.join(self.downloader_dir, torrent_filename) if not os.path.exists(self.downloader_dir): os.makedirs(self.downloader_dir) shutil.copy(torrent_filepath, downloaded_filepath) with patch('monitorrent.plugins.clients.downloader.os.remove') as remove: remove.side_effect = OSError self.assertFalse(plugin.remove_torrent(torrent.info_hash)) self.assertTrue(os.path.exists(downloaded_filepath))
def test_remove_torrent(self): torrent_filename = 'Hell.On.Wheels.S05E02.720p.WEB.rus.LostFilm.TV.mp4.torrent' torrent_filepath = self.get_httpretty_filename(torrent_filename) torrent = Torrent.from_file(torrent_filepath) plugin = DownloaderPlugin() self.assertFalse(plugin.remove_torrent(torrent.info_hash)) settings = {'path': self.downloader_dir} plugin.set_settings(settings) self.assertFalse(plugin.remove_torrent(torrent.info_hash)) downloaded_filepath = os.path.join(self.downloader_dir, torrent_filename) if not os.path.exists(self.downloader_dir): os.makedirs(self.downloader_dir) shutil.copy(torrent_filepath, downloaded_filepath) self.assertFalse(plugin.remove_torrent("RANDOM_HASH")) self.assertTrue(plugin.remove_torrent(torrent.info_hash)) self.assertFalse(os.path.exists(downloaded_filepath))
def test_remove_torrent(self): torrent_filename = 'Hell.On.Wheels.S05E02.720p.WEB.rus.LostFilm.TV.mp4.torrent' torrent_filepath = self.get_httpretty_filename(torrent_filename) torrent = Torrent.from_file(torrent_filepath) plugin = DownloaderPlugin() self.assertFalse(plugin.remove_torrent(torrent.info_hash)) settings = {'path': self.downloader_dir} plugin.set_settings(settings) self.assertFalse(plugin.remove_torrent(torrent.info_hash)) downloaded_filepath = os.path.join(self.downloader_dir, torrent_filename) if not os.path.exists(self.downloader_dir): os.makedirs(self.downloader_dir) shutil.copy(torrent_filepath, downloaded_filepath) self.assertFalse(plugin.remove_torrent("RANDOM_HASH")) self.assertTrue(plugin.remove_torrent(torrent.info_hash)) self.assertFalse(os.path.exists(downloaded_filepath))