def load_custom_mirror_pool(self): """ Load available custom mirrors and update their status from status.json If user request reset (--default) load the default pool """ if self.default: defaultFn.load_default_mirror_pool(self) else: defaultFn.seed_mirrors(self, self.config["custom_file"]) self.mirrors.mirror_pool = apply_status_to_custom_mirror_pool(self.config, self.mirrors.mirror_pool)
def test_full_run_rank(self, mock_build_config, mock_os_getuid): """TEST: pacman-mirrors -c all""" mock_os_getuid.return_value = 0 mock_build_config.return_value = test_conf with unittest.mock.patch("sys.argv", ["pacman-mirrors", "-c", "all"]): app = PacmanMirrors() app.config = configFn.setup_config() fileFn.create_dir(test_conf["work_dir"]) cliFn.parse_command_line(app, True) httpFn.update_mirror_pool(app.config) defaultFn.load_default_mirror_pool(app) common.build_mirror_list(app)
def test_full_run_rank(self, mock_build_config, mock_os_getuid): """TEST: pacman-mirrors -c all""" mock_os_getuid.return_value = 0 mock_build_config.return_value = test_conf with unittest.mock.patch("sys.argv", ["pacman-mirrors", "-c", "all"]): app = PacmanMirrors() app.config = configFn.setup_config() fileFn.create_dir(test_conf["work_dir"]) cliFn.parse_command_line(app, True) httpFn.update_mirror_pool(app.config) defaultFn.load_default_mirror_pool(app) common.build_mirror_list(app)
def test_geoip_available(self, mock_build_config, mock_get_geoip_country, mock_os_getuid): """TEST: geoip country IS avaiable""" mock_os_getuid.return_value = 0 mock_build_config.return_value = test_conf mock_get_geoip_country.return_value = ["Denmark"] with unittest.mock.patch("sys.argv", ["pacman-mirrors", "--geoip"]): app = PacmanMirrors() app.config = configFn.setup_config() cliFn.parse_command_line(app, True) defaultFn.load_default_mirror_pool(app) app.selected_countries = httpFn.get_ip_country() assert app.selected_countries == ["Denmark"]
def test_geoip_available(self, mock_build_config, mock_get_geoip_country, mock_os_getuid): """TEST: geoip country IS avaiable""" mock_os_getuid.return_value = 0 mock_build_config.return_value = test_conf mock_get_geoip_country.return_value = ["Denmark"] with unittest.mock.patch("sys.argv", ["pacman-mirrors", "--geoip"]): app = PacmanMirrors() app.config = configFn.setup_config() cliFn.parse_command_line(app, True) defaultFn.load_default_mirror_pool(app) app.selected_countries = httpFn.get_geoip_country() assert app.selected_countries == ["Denmark"]
def console_default_country_pool(self): """ List all available countries """ defaultFn.load_default_mirror_pool(self) print("{}".format("\n".join(self.mirrors.country_pool)))
def tty_default_pool(self) -> None: """ List all available countries """ defaultFn.load_default_mirror_pool(self) print("{}".format("\n".join(self.mirrors.country_pool)))