Пример #1
0
    def test_downloadconfig(self):
        dlcfg = DownloadConfigInterface()

        self.assertIsInstance(dlcfg.get_dest_dir(), six.text_type)
        dlcfg.set_dest_dir(self.session_base_dir)
        self.assertEqual(dlcfg.get_dest_dir(), self.session_base_dir)

        dlcfg.set_corrected_filename("foobar")
        self.assertEqual(dlcfg.get_corrected_filename(), "foobar")

        dlcfg.set_mode(1)
        self.assertEqual(dlcfg.get_mode(), 1)

        dlcfg.set_hops(4)
        self.assertEqual(dlcfg.get_hops(), 4)

        dlcfg.set_safe_seeding(False)
        self.assertFalse(dlcfg.get_safe_seeding())

        dlcfg.set_seeding_mode("abcd")
        self.assertEqual(dlcfg.get_seeding_mode(), "abcd")

        dlcfg.set_selected_files("foo.bar")
        self.assertEqual(dlcfg.get_selected_files(), ["foo.bar"])

        dlcfg.set_channel_download(True)
        self.assertTrue(dlcfg.get_channel_download())
Пример #2
0
    def test_downloadconfig(self):
        dlcfg = DownloadConfigInterface()

        self.assertIsInstance(dlcfg.get_dest_dir(), unicode)
        dlcfg.set_dest_dir(self.session_base_dir)
        self.assertEqual(dlcfg.get_dest_dir(), self.session_base_dir)

        dlcfg.set_corrected_filename("foobar")
        self.assertEqual(dlcfg.get_corrected_filename(), "foobar")

        dlcfg.set_mode(1)
        self.assertEqual(dlcfg.get_mode(), 1)

        dlcfg.set_hops(4)
        self.assertEqual(dlcfg.get_hops(), 4)

        dlcfg.set_safe_seeding(False)
        self.assertFalse(dlcfg.get_safe_seeding())

        dlcfg.set_seeding_mode("abcd")
        self.assertEqual(dlcfg.get_seeding_mode(), "abcd")

        dlcfg.set_selected_files("foo.bar")
        self.assertEqual(dlcfg.get_selected_files(), ["foo.bar"])

        dlcfg.set_channel_download(True)
        self.assertTrue(dlcfg.get_channel_download())
Пример #3
0
    def test_downloadconfig(self):
        dlconf = CallbackConfigParser()
        dlconf.add_section('downloadconfig')
        dlconf.set('downloadconfig', 'hops', 5)
        dlcfg = DownloadConfigInterface(dlconf)

        self.assertIsInstance(dlcfg.get_dest_dir(), unicode)
        dlcfg.set_dest_dir(self.session_base_dir)
        self.assertEqual(dlcfg.get_dest_dir(), self.session_base_dir)

        dlcfg.set_corrected_filename("foobar")
        self.assertEqual(dlcfg.get_corrected_filename(), "foobar")

        dlcfg.set_mode(1)
        self.assertEqual(dlcfg.get_mode(), 1)

        dlcfg.set_hops(4)
        self.assertEqual(dlcfg.get_hops(), 4)

        dlcfg.set_safe_seeding(False)
        self.assertFalse(dlcfg.get_safe_seeding())

        dlcfg.set_selected_files("foo.bar")
        self.assertEqual(dlcfg.get_selected_files(), ["foo.bar"])

        dlcfg.set_max_speed(UPLOAD, 1337)
        dlcfg.set_max_speed(DOWNLOAD, 1338)
        self.assertEqual(dlcfg.get_max_speed(UPLOAD), 1337)
        self.assertEqual(dlcfg.get_max_speed(DOWNLOAD), 1338)