def test_load_paste_app(self, mock_deploy): mock_deploy.return_value = 'test' self.config(api_paste_config='api-paste.ini.test') config.load_paste_app('tacker') config_path = os.path.abspath(cfg.CONF.find_file( cfg.CONF.api_paste_config)) mock_deploy.assert_called_once_with('config:%s' % config_path, name='tacker')
def setUp(self): super(ExtensionExtendedAttributeTestCase, self).setUp() plugin = ("tacker.tests.unit.test_extension_extended_attribute." "ExtensionExtendedAttributeTestPlugin") # point config file to: tacker/tests/etc/tacker.conf.test self.config_parse() self.setup_coreplugin(plugin) ext_mgr = extensions.ExtensionManager(extensions_path) ext_mgr.extend_resources("1.0", {}) extensions.ExtensionManager._instance = ext_mgr app = config.load_paste_app('extensions_test_app') self._api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr) self._tenant_id = "8c70909f-b081-452d-872b-df48e6c355d1" # Save the global RESOURCE_ATTRIBUTE_MAP self.saved_attr_map = {} for resource, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.iteritems(): self.saved_attr_map[resource] = attrs.copy() # Add the resources to the global attribute map # This is done here as the setup process won't # initialize the main API router which extends # the global attribute map attributes.RESOURCE_ATTRIBUTE_MAP.update( extattr.EXTENDED_ATTRIBUTES_2_0) self.agentscheduler_dbMinxin = manager.TackerManager.get_plugin() self.addCleanup(self.restore_attribute_map)
def setUp(self): super(ExtensionExtendedAttributeTestCase, self).setUp() plugin = ( "tacker.tests.unit.test_extension_extended_attribute." "ExtensionExtendedAttributeTestPlugin" ) # point config file to: tacker/tests/etc/tacker.conf.test self.config_parse() self.setup_coreplugin(plugin) ext_mgr = extensions.ExtensionManager(extensions_path) ext_mgr.extend_resources("1.0", {}) extensions.ExtensionManager._instance = ext_mgr app = config.load_paste_app('extensions_test_app') self._api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr) self._tenant_id = "8c70909f-b081-452d-872b-df48e6c355d1" # Save the global RESOURCE_ATTRIBUTE_MAP self.saved_attr_map = {} for resource, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.iteritems(): self.saved_attr_map[resource] = attrs.copy() # Add the resources to the global attribute map # This is done here as the setup process won't # initialize the main API router which extends # the global attribute map attributes.RESOURCE_ATTRIBUTE_MAP.update( extattr.EXTENDED_ATTRIBUTES_2_0) self.agentscheduler_dbMinxin = manager.TackerManager.get_plugin() self.addCleanup(self.restore_attribute_map)
def _run_wsgi(app_name): app = config.load_paste_app(app_name) if not app: LOG.error(_('No known API applications configured.')) return server = wsgi.Server("Tacker") server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host, workers=cfg.CONF.api_workers) # Dump all option values here after all options are parsed cfg.CONF.log_opt_values(LOG, std_logging.DEBUG) LOG.info(_("Tacker service started, listening on %(host)s:%(port)s"), {'host': cfg.CONF.bind_host, 'port': cfg.CONF.bind_port}) return server
def _run_wsgi(app_name): app = config.load_paste_app(app_name) if not app: LOG.error('No known API applications configured.') return server = wsgi.Server("Tacker") server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host, workers=cfg.CONF.api_workers) # Dump all option values here after all options are parsed cfg.CONF.log_opt_values(LOG, std_logging.DEBUG) LOG.info("Tacker service started, listening on %(host)s:%(port)s", {'host': cfg.CONF.bind_host, 'port': cfg.CONF.bind_port}) return server
def setup_extensions_middleware(extension_manager=None): extension_manager = (extension_manager or extensions.ExtensionManager(extensions_path)) base.BaseTestCase.config_parse() app = config.load_paste_app('extensions_test_app') return extensions.ExtensionMiddleware(app, ext_mgr=extension_manager)
def setup_base_app(test): base.BaseTestCase.config_parse() app = config.load_paste_app('extensions_test_app') return app