def test_get_set_methods_tunnel_community(self): """ Check whether tunnel community get and set methods are working as expected. """ self.tribler_config.set_tunnel_community_enabled(True) self.assertEqual(self.tribler_config.get_tunnel_community_enabled(), True) self.tribler_config.set_tunnel_community_socks5_listen_ports([-1]) self.assertNotEqual( self.tribler_config.get_tunnel_community_socks5_listen_ports(), [-1]) self.tribler_config.set_tunnel_community_socks5_listen_ports([5]) self.assertEqual( self.tribler_config.get_tunnel_community_socks5_listen_ports(), [5]) self.tribler_config.set_tunnel_community_exitnode_enabled(True) self.assertEqual( self.tribler_config.get_tunnel_community_exitnode_enabled(), True) self.tribler_config.set_default_number_hops(True) self.assertEqual(self.tribler_config.get_default_number_hops(), True) self.tribler_config.set_default_anonymity_enabled(True) self.assertEqual(self.tribler_config.get_default_anonymity_enabled(), True) self.tribler_config.set_default_safeseeding_enabled(True) self.assertEqual(self.tribler_config.get_default_safeseeding_enabled(), True) self.tribler_config.set_default_destination_dir(get_home_dir()) self.assertEqual(self.tribler_config.get_default_destination_dir(), path_util.Path(get_home_dir())) self.tribler_config.set_tunnel_community_random_slots(10) self.assertEqual( self.tribler_config.get_tunnel_community_random_slots(), 10) self.tribler_config.set_tunnel_community_competing_slots(20) self.assertEqual( self.tribler_config.get_tunnel_community_competing_slots(), 20)
def test_get_set_methods_tunnel_community(tribler_config): """ Check whether tunnel community get and set methods are working as expected. """ tribler_config.set_tunnel_community_enabled(True) assert tribler_config.get_tunnel_community_enabled() tribler_config.set_tunnel_community_socks5_listen_ports([-1]) assert tribler_config.get_tunnel_community_socks5_listen_ports() != [ -1 ] # We cannot set a negative port tribler_config.set_tunnel_community_socks5_listen_ports([5]) assert tribler_config.get_tunnel_community_socks5_listen_ports() == [5] tribler_config.set_tunnel_community_exitnode_enabled(True) assert tribler_config.get_tunnel_community_exitnode_enabled() tribler_config.set_default_number_hops(324) assert tribler_config.get_default_number_hops() == 324 tribler_config.set_default_anonymity_enabled(True) assert tribler_config.get_default_anonymity_enabled() tribler_config.set_default_safeseeding_enabled(True) assert tribler_config.get_default_safeseeding_enabled() tribler_config.set_default_destination_dir(get_home_dir()) assert tribler_config.get_default_destination_dir() == Path(get_home_dir()) tribler_config.set_tunnel_community_random_slots(10) assert tribler_config.get_tunnel_community_random_slots() == 10 tribler_config.set_tunnel_community_competing_slots(20) assert tribler_config.get_tunnel_community_competing_slots() == 20 tribler_config.set_tunnel_testnet(True) assert tribler_config.get_tunnel_testnet()
def test_get_set_methods_watch_folder(tribler_config): """ Check whether watch folder get and set methods are working as expected. """ tribler_config.set_watch_folder_enabled(True) assert tribler_config.get_watch_folder_enabled() tribler_config.set_watch_folder_path(get_home_dir()) assert tribler_config.get_watch_folder_path() == get_home_dir()
def test_get_set_methods_watch_folder(self): """ Check whether watch folder get and set methods are working as expected. """ self.tribler_config.set_watch_folder_enabled(True) self.assertEqual(self.tribler_config.get_watch_folder_enabled(), True) self.tribler_config.set_watch_folder_path(get_home_dir()) self.assertEqual(self.tribler_config.get_watch_folder_path(), get_home_dir())
def get_default_dest_dir(): """ Returns the default dir to save content to. If Downloads/ exists: Downloads/TriblerDownloads else: Home/TriblerDownloads """ download_dir = Path("TriblerDownloads") # TODO: Is this here so the unit tests work? if download_dir.is_dir(): return path_util.abspath(download_dir) downloads_dir = get_home_dir() / "Downloads" if downloads_dir.is_dir(): return downloads_dir / download_dir return get_home_dir() / download_dir
def get_default_dest_dir(): """ Returns the default dir to save content to. """ tribler_downloads = Path("TriblerDownloads") if tribler_downloads.is_dir(): return tribler_downloads.resolve() home = get_home_dir() downloads = home / "Downloads" if downloads.is_dir(): return (downloads / tribler_downloads).resolve() return (home / tribler_downloads).resolve()
def test_home_dir(self): home_dir = get_home_dir() self.assertIsInstance(home_dir, path_util.Path) self.assertTrue(home_dir.is_dir())
def test_home_dir(): home_dir = get_home_dir() assert isinstance(home_dir, Path) assert home_dir.is_dir()