def setUp(self): self.tmpdir = tempfile.mkdtemp() self.rest_service_log = tempfile.mkstemp()[1] self.securest_log_file = tempfile.mkstemp()[1] self.file_server = FileServer(self.tmpdir) self.addCleanup(self.cleanup) self.file_server.start() storage_manager.storage_manager_module_name = \ STORAGE_MANAGER_MODULE_NAME # workaround for setting the rest service log path, since it's # needed when 'server' module is imported. # right after the import the log path is set normally like the rest # of the variables (used in the reset_state) tmp_conf_file = tempfile.mkstemp()[1] json.dump({'rest_service_log_path': self.rest_service_log, 'rest_service_log_file_size_MB': 1, 'rest_service_log_files_backup_count': 1, 'rest_service_log_level': 'DEBUG'}, open(tmp_conf_file, 'w')) os.environ['MANAGER_REST_CONFIG_PATH'] = tmp_conf_file try: from manager_rest import server finally: del(os.environ['MANAGER_REST_CONFIG_PATH']) server.reset_state(self.create_configuration()) utils.copy_resources(config.instance().file_server_root) server.setup_app() server.app.config['Testing'] = True self.app = server.app.test_client() self.client = self.create_client() self.initialize_provider_context()
def setUp(self): self.tmpdir = tempfile.mkdtemp() self.rest_service_log = tempfile.mkstemp()[1] self.securest_log_file = tempfile.mkstemp()[1] self.file_server = FileServer(self.tmpdir) self.maintenance_mode_dir = tempfile.mkdtemp() self.addCleanup(self.cleanup) self.file_server.start() storage_manager.storage_manager_module_name = \ STORAGE_MANAGER_MODULE_NAME # workaround for setting the rest service log path, since it's # needed when 'server' module is imported. # right after the import the log path is set normally like the rest # of the variables (used in the reset_state) tmp_conf_file = tempfile.mkstemp()[1] json.dump({'rest_service_log_path': self.rest_service_log, 'rest_service_log_file_size_MB': 1, 'rest_service_log_files_backup_count': 1, 'rest_service_log_level': 'DEBUG'}, open(tmp_conf_file, 'w')) os.environ['MANAGER_REST_CONFIG_PATH'] = tmp_conf_file try: from manager_rest import server finally: del(os.environ['MANAGER_REST_CONFIG_PATH']) self.server_configuration = self.create_configuration() server.reset_state(self.server_configuration) utils.copy_resources(config.instance().file_server_root) server.setup_app() server.app.config['Testing'] = True self.app = server.app.test_client() self.client = self.create_client() self.initialize_provider_context()
def setUp(self): self.tmpdir = tempfile.mkdtemp() self.file_server = FileServer(self.tmpdir) self.file_server.start() storage_manager.storage_manager_module_name = \ STORAGE_MANAGER_MODULE_NAME server.reset_state(self.create_configuration()) util.copy_resources(config.instance().file_server_root) server.setup_app() server.app.config['Testing'] = True self.app = server.app.test_client()
def setUp(self): self.tmpdir = tempfile.mkdtemp() self.file_server = FileServer(self.tmpdir) self.file_server.start() storage_manager.storage_manager_module_name = \ STORAGE_MANAGER_MODULE_NAME server.reset_state(self.create_configuration()) util.copy_resources(config.instance().file_server_root) server.setup_app() server.app.config['Testing'] = True self.app = server.app.test_client() self.client = CloudifyClient('localhost') mock_http_client = MockHTTPClient(self.app) self.client.blueprints.api = mock_http_client self.client.deployments.api = mock_http_client self.client.executions.api = mock_http_client self.client.nodes.api = mock_http_client self.client.node_instances.api = mock_http_client self.client.manager.api = mock_http_client
def setUp(self): self.tmpdir = tempfile.mkdtemp() self.file_server = FileServer(self.tmpdir) self.file_server.start() storage_manager.storage_manager_module_name = \ STORAGE_MANAGER_MODULE_NAME server.reset_state(self.create_configuration()) util.copy_resources(config.instance().file_server_root) server.setup_app() server.app.config['Testing'] = True self.app = server.app.test_client() self.client = CloudifyClient('localhost') mock_http_client = MockHTTPClient(self.app) self.client.blueprints.api = mock_http_client self.client.deployments.api = mock_http_client self.client.deployments.outputs.api = mock_http_client self.client.executions.api = mock_http_client self.client.nodes.api = mock_http_client self.client.node_instances.api = mock_http_client self.client.manager.api = mock_http_client
def setUp(self): self.tmpdir = tempfile.mkdtemp() self.rest_service_log = tempfile.mkstemp()[1] self.file_server = FileServer(self.tmpdir) self.file_server.start() storage_manager.storage_manager_module_name = \ STORAGE_MANAGER_MODULE_NAME # workaround for setting the rest service log path, since it's # needed when 'server' module is imported. # right after the import the log path is set normally like the rest # of the variables (used in the reset_state) tmp_conf_file = tempfile.mkstemp()[1] json.dump({'rest_service_log_path': self.rest_service_log}, open(tmp_conf_file, 'w')) os.environ['MANAGER_REST_CONFIG_PATH'] = tmp_conf_file try: from manager_rest import server finally: del(os.environ['MANAGER_REST_CONFIG_PATH']) server.reset_state(self.create_configuration()) util.copy_resources(config.instance().file_server_root) server.setup_app() server.app.config['Testing'] = True self.app = server.app.test_client() self.client = CloudifyClient('localhost') mock_http_client = MockHTTPClient(self.app) self.client._client = mock_http_client self.client.blueprints.api = mock_http_client self.client.deployments.api = mock_http_client self.client.deployments.outputs.api = mock_http_client self.client.deployments.modify.api = mock_http_client self.client.executions.api = mock_http_client self.client.nodes.api = mock_http_client self.client.node_instances.api = mock_http_client self.client.manager.api = mock_http_client self.client.evaluate.api = mock_http_client