Example #1
0
    def test_add_torrent_success(self):
        torrent = self.read_httpretty_content('Hell.On.Wheels.S05E02.720p.WEB.rus.LostFilm.TV.mp4.torrent', 'rb')

        plugin = DownloaderPlugin()
        settings = {'path': self.downloader_dir}
        self.assertFalse(plugin.add_torrent(torrent, None))
        plugin.set_settings(settings)

        self.assertTrue(plugin.add_torrent(torrent, None))
        created_file = os.path.join(self.downloader_dir, "A7BF281BE37BAF50E5725584DAF93AEFB3DD484A.torrent")
        self.assertTrue(os.path.exists(created_file))
Example #2
0
    def test_add_torrent_success(self):
        torrent = self.read_httpretty_content('Hell.On.Wheels.S05E02.720p.WEB.rus.LostFilm.TV.mp4.torrent', 'rb')

        plugin = DownloaderPlugin()
        settings = {'path': self.downloader_dir}
        self.assertFalse(plugin.add_torrent(torrent))
        plugin.set_settings(settings)

        self.assertTrue(plugin.add_torrent(torrent))
        created_file = os.path.join(self.downloader_dir, "A7BF281BE37BAF50E5725584DAF93AEFB3DD484A.torrent")
        self.assertTrue(os.path.exists(created_file))
Example #3
0
    def test_add_torrent_failed_2(self):
        torrent = self.read_httpretty_content('Hell.On.Wheels.S05E02.720p.WEB.rus.LostFilm.TV.mp4.torrent', 'rb')

        plugin = DownloaderPlugin()
        settings = {'path': self.downloader_dir}
        plugin.set_settings(settings)

        open_mock = MagicMock(side_effect=OSError)
        with patch("monitorrent.plugins.clients.downloader.open", open_mock):
            self.assertFalse(plugin.add_torrent(torrent, None))
Example #4
0
    def test_add_torrent_failed_2(self):
        torrent = self.read_httpretty_content('Hell.On.Wheels.S05E02.720p.WEB.rus.LostFilm.TV.mp4.torrent', 'rb')

        plugin = DownloaderPlugin()
        settings = {'path': self.downloader_dir}
        plugin.set_settings(settings)

        open_mock = MagicMock(side_effect=OSError)
        with patch("monitorrent.plugins.clients.downloader.open", open_mock):
            self.assertFalse(plugin.add_torrent(torrent))
Example #5
0
    def test_add_torrent_failed_1(self):
        plugin = DownloaderPlugin()
        settings = {'path': self.downloader_dir}
        plugin.set_settings(settings)

        self.assertFalse(plugin.add_torrent("FAKE TORRENT", None))
Example #6
0
    def test_add_torrent_failed_1(self):
        plugin = DownloaderPlugin()
        settings = {'path': self.downloader_dir}
        plugin.set_settings(settings)

        self.assertFalse(plugin.add_torrent("FAKE TORRENT", None))