def source_context(self): with self.temporary_base_directory_context(): config = Configuration.from_disk(None) setup_all(config) with self.ftp_server_context(config), self.rpc_server_context( config), self.web_server_context(config): yield config
def server_context(self): with self.temporary_base_directory_context(): config = self._get_config_for_test() setup_all(config) with self.ftp_server_context(config), self.rpc_server_context(config), self.web_server_context(config): sleep(1) yield config
def server_context(self): with self.temporary_base_directory_context(): config = Configuration.from_disk(None) setup_all(config) with self.ftp_server_context(config), self.rpc_server_context(config), self.web_server_context(config): sleep(1) yield config
def target_context(self): with self.temporary_base_directory_context(): config = Configuration.from_disk(None) config.ftpserver.port += 10 config.webserver.port += 10 config.rpcserver.port += 10 setup_all(config) with self.ftp_server_context(config), self.rpc_server_context(config), self.web_server_context(config): yield config
def target_context(self): with self.temporary_base_directory_context(): config = self._get_config_for_test() config.ftpserver.port += 10 config.webserver.port += 10 config.rpcserver.port += 10 setup_all(config) with self.ftp_server_context(config), self.rpc_server_context(config), self.web_server_context(config): yield config
def test_counters_from_web_and_ftp_servers(self): with patch_all(), self.temporary_base_directory_context(): config = self._get_config_for_test() setup_all(config) with self.web_server_context(config), self.ftp_server_context(config): self._get_from_http(config, "/packages/main-stable/index/packages.json") self._get_from_ftp(config, "/packages/main-stable/index/packages.json") sleep(1) counters = get_counters(config) self.assertEquals(counters, {"/packages/main-stable/index/packages.json": 2})
def target_context(self): with self.temporary_base_directory_context(): config = self._get_config_for_test() config.ftpserver.port += 10 config.webserver.port += 10 config.rpcserver.port += 10 setup_all(config) with self.ftp_server_context(config), self.rpc_server_context( config), self.web_server_context(config): yield config
def target_context(self): with self.temporary_base_directory_context(): config = Configuration.from_disk(None) config.ftpserver.port += 10 config.webserver.port += 10 config.rpcserver.port += 10 setup_all(config) with self.ftp_server_context(config), self.rpc_server_context( config), self.web_server_context(config): yield config
def test_counters_from_web_and_ftp_servers(self): with patch_all(), self.temporary_base_directory_context(): config = self._get_config_for_test() setup_all(config) with self.web_server_context(config), self.ftp_server_context(config): self._get_from_http(config, "/packages/main-stable/index/packages.json") self._get_from_ftp(config, "/packages/main-stable/index/packages.json") sleep(1) counters = get_counters(config) self.assertEqual(counters, {"/packages/main-stable/index/packages.json": 2})
def setup(config, apply_mock_patches, force_resignature): from infi.app_repo.install import setup_all from infi.app_repo.mock import patch_all, empty_context with (patch_all if apply_mock_patches else empty_context)(): setup_all(config, force_resignature, shell_completion=True)