當前位置: 首頁>>代碼示例>>Python>>正文


Python pecan.set_config方法代碼示例

本文整理匯總了Python中pecan.set_config方法的典型用法代碼示例。如果您正苦於以下問題:Python pecan.set_config方法的具體用法?Python pecan.set_config怎麽用?Python pecan.set_config使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pecan的用法示例。


在下文中一共展示了pecan.set_config方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: import pecan [as 別名]
# 或者: from pecan import set_config [as 別名]
def setUp(self):
        super(FunctionalTest, self).setUp()
        cfg.CONF.set_override("auth_version", "v2.0",
                              group='keystone_authtoken')
        cfg.CONF.set_override("admin_user", "admin",
                              group='keystone_authtoken')

        p_services = mock.patch.object(n_service, "send_service_update",
                                       new_callable=mock.PropertyMock)
        self.m_services = p_services.start()
        self.addCleanup(p_services.stop)

        self.app = self._make_app()

        def reset_pecan():
            pecan.set_config({}, overwrite=True)

        self.addCleanup(reset_pecan) 
開發者ID:openstack,項目名稱:watcher,代碼行數:20,代碼來源:base.py

示例2: setUp

# 需要導入模塊: import pecan [as 別名]
# 或者: from pecan import set_config [as 別名]
def setUp(self):
        super(FunctionalTest, self).setUp()
        zun.conf.CONF.set_override("auth_version", "v2.0",
                                   group='keystone_authtoken')
        zun.conf.CONF.set_override("admin_user", "admin",
                                   group='keystone_authtoken')
        p = mock.patch('zun.scheduler.client.query.SchedulerClient')
        p.start()
        self.addCleanup(p.stop)

        # Determine where we are so we can set up paths in the config
        root_dir = self.get_path()
        self.config = {
            'app': {
                'root': 'zun.api.controllers.root.RootController',
                'modules': ['zun.api'],
                'static_root': '%s/public' % root_dir,
                'template_path': '%s/api/templates' % root_dir,
                'hooks': [
                    hooks.ContextHook(),
                    hooks.RPCHook(),
                    hooks.NoExceptionTracebackHook(),
                ],
            },
        }

        self.app = self._make_app()

        def reset_pecan():
            pecan.set_config({}, overwrite=True)

        self.addCleanup(reset_pecan) 
開發者ID:openstack,項目名稱:zun,代碼行數:34,代碼來源:base.py

示例3: setUp

# 需要導入模塊: import pecan [as 別名]
# 或者: from pecan import set_config [as 別名]
def setUp(self):
        super(TestHealthCheck, self).setUp()

        # We need to define these early as they are late loaded in oslo
        # middleware and our configuration overrides would not apply.
        # Note: These must match exactly the option definitions in
        # oslo.middleware healthcheck! If not you will get duplicate option
        # errors.
        healthcheck_opts = [
            cfg.BoolOpt(
                'detailed', default=False,
                help='Show more detailed information as part of the response. '
                     'Security note: Enabling this option may expose '
                     'sensitive details about the service being monitored. '
                     'Be sure to verify that it will not violate your '
                     'security policies.'),
            cfg.ListOpt(
                'backends', default=[],
                help='Additional backends that can perform health checks and '
                     'report that information back as part of a request.'),
        ]
        cfg.CONF.register_opts(healthcheck_opts, group='healthcheck')

        self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
        self.conf.config(group='healthcheck', backends=['octavia_db_check'])
        self.UNAVAILABLE = (healthcheck_plugins.OctaviaDBHealthcheck.
                            UNAVAILABLE_REASON)

        def reset_pecan():
            pecan.set_config({}, overwrite=True)

        self.addCleanup(reset_pecan) 
開發者ID:openstack,項目名稱:octavia,代碼行數:34,代碼來源:test_healthcheck.py

示例4: setUp

# 需要導入模塊: import pecan [as 別名]
# 或者: from pecan import set_config [as 別名]
def setUp(self):
        super(BaseAPITest, self).setUp()
        self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
        self.conf.config(group="controller_worker",
                         network_driver='network_noop_driver')
        self.conf.config(group='api_settings', auth_strategy=constants.NOAUTH)
        self.conf.config(group='api_settings',
                         default_provider_driver='noop_driver')
        # We still need to test with the "octavia" alias
        self.conf.config(group='api_settings',
                         enabled_provider_drivers={
                             'amphora': 'Amp driver.',
                             'noop_driver': 'NoOp driver.',
                             'noop_driver-alt': 'NoOp driver alt alisas.',
                             'octavia': 'Octavia driver.'})
        self.lb_repo = repositories.LoadBalancerRepository()
        self.listener_repo = repositories.ListenerRepository()
        self.listener_stats_repo = repositories.ListenerStatisticsRepository()
        self.pool_repo = repositories.PoolRepository()
        self.member_repo = repositories.MemberRepository()
        self.l7policy_repo = repositories.L7PolicyRepository()
        self.l7rule_repo = repositories.L7RuleRepository()
        self.health_monitor_repo = repositories.HealthMonitorRepository()
        self.amphora_repo = repositories.AmphoraRepository()
        self.flavor_repo = repositories.FlavorRepository()
        self.flavor_profile_repo = repositories.FlavorProfileRepository()
        patcher2 = mock.patch('octavia.certificates.manager.barbican.'
                              'BarbicanCertManager')
        self.cert_manager_mock = patcher2.start()
        self.app = self._make_app()
        self.project_id = uuidutils.generate_uuid()

        def reset_pecan():
            pecan.set_config({}, overwrite=True)

        self.addCleanup(reset_pecan) 
開發者ID:openstack,項目名稱:octavia,代碼行數:38,代碼來源:base.py

示例5: setUp

# 需要導入模塊: import pecan [as 別名]
# 或者: from pecan import set_config [as 別名]
def setUp(self):
        super(FunctionalTest, self).setUp()
        cfg.CONF.set_override("auth_version", "v2.0",
                              group='keystone_authtoken')
        cfg.CONF.set_override("admin_user", "admin",
                              group='keystone_authtoken')

        # Determine where we are so we can set up paths in the config
        self.config = {
            'app': {
                'root': 'magnum.api.controllers.root.RootController',
                'modules': ['magnum.api'],
                'hooks': [
                    hooks.ContextHook(),
                    hooks.RPCHook(),
                    hooks.NoExceptionTracebackHook(),
                ],
            },
        }

        self.app = self._make_app()

        def reset_pecan():
            pecan.set_config({}, overwrite=True)

        self.addCleanup(reset_pecan)

        p = mock.patch('magnum.api.controllers.v1.Controller._check_version')
        self._check_version = p.start()
        self.addCleanup(p.stop) 
開發者ID:openstack,項目名稱:magnum,代碼行數:32,代碼來源:base.py

示例6: setUp

# 需要導入模塊: import pecan [as 別名]
# 或者: from pecan import set_config [as 別名]
def setUp(self):
        super(FunctionalTest, self).setUp()
        root = self.root
        config = {'app': {'root': root}}
        pecan.set_config(config, overwrite=True)
        self.app = webtest.TestApp(pecan.make_app(root)) 
開發者ID:cloud-security-research,項目名稱:sgx-kms,代碼行數:8,代碼來源:test_transport_keys_resource.py

示例7: tearDown

# 需要導入模塊: import pecan [as 別名]
# 或者: from pecan import set_config [as 別名]
def tearDown(self):
        super(FunctionalTest, self).tearDown()
        pecan.set_config({}, overwrite=True) 
開發者ID:cloud-security-research,項目名稱:sgx-kms,代碼行數:5,代碼來源:test_transport_keys_resource.py

示例8: _reset_singletons

# 需要導入模塊: import pecan [as 別名]
# 或者: from pecan import set_config [as 別名]
def _reset_singletons(self):
        service.Singleton._instances.clear()

        def reset_pecan():
            pecan.set_config({}, overwrite=True)

        self.addCleanup(reset_pecan) 
開發者ID:openstack,項目名稱:watcher,代碼行數:9,代碼來源:base.py

示例9: setUp

# 需要導入模塊: import pecan [as 別名]
# 或者: from pecan import set_config [as 別名]
def setUp(self):
        super(BaseApiTest, self).setUp()
        cfg.CONF.set_override("auth_version", "v3",
                              group='keystone_authtoken')
        cfg.CONF.set_override("admin_user", "admin",
                              group='keystone_authtoken')
        self.app = self._make_app()

        def reset_pecan():
            pecan.set_config({}, overwrite=True)

        self.addCleanup(reset_pecan) 
開發者ID:openstack,項目名稱:cyborg,代碼行數:14,代碼來源:base.py

示例10: setUp

# 需要導入模塊: import pecan [as 別名]
# 或者: from pecan import set_config [as 別名]
def setUp(self):
        super(APITest, self).setUp()

        # Config package directory before app starts.
        package_dir = tempfile.mkdtemp(prefix='tmp_qinling')
        self.override_config('file_system_dir', package_dir, 'storage')
        self.addCleanup(shutil.rmtree, package_dir, True)

        # Disable authentication by default for API tests.
        self.override_config('auth_enable', False, group='pecan')

        # Disable job handler. The following pecan app instantiation will
        # invoke qinling.api.app:setup_app()
        self.override_config('enable_job_handler', False, group='api')

        pecan_opts = CONF.pecan
        self.app = pecan.testing.load_test_app({
            'app': {
                'root': pecan_opts.root,
                'modules': pecan_opts.modules,
                'debug': pecan_opts.debug,
                'auth_enable': False,
            }
        })

        self.addCleanup(pecan.set_config, {}, overwrite=True)

        self.patch_ctx = mock.patch('qinling.context.Context.from_environ')
        self.mock_ctx = self.patch_ctx.start()
        self.mock_ctx.return_value = self.ctx
        self.addCleanup(self.patch_ctx.stop) 
開發者ID:openstack,項目名稱:qinling,代碼行數:33,代碼來源:base.py

示例11: setUp

# 需要導入模塊: import pecan [as 別名]
# 或者: from pecan import set_config [as 別名]
def setUp(self):
        super(TestCase, self).setUp()
        token_info = {
            'token': {
                'project': {
                    'id': 'fake_project'
                },
                'user': {
                    'id': 'fake_user'
                }
            }
        }
        self.context = zun_context.RequestContext(
            auth_token_info=token_info,
            project_id='fake_project',
            is_admin=False,
            user_id='fake_user')

        def make_context(*args, **kwargs):
            # If context hasn't been constructed with token_info
            if not kwargs.get('auth_token_info'):
                kwargs['auth_token_info'] = copy.deepcopy(token_info)
            if not kwargs.get('project_id'):
                kwargs['project_id'] = 'fake_project'
            if not kwargs.get('user_id'):
                kwargs['user_id'] = 'fake_user'
            if not kwargs.get('is_admin'):
                kwargs['is_admin'] = False

            context = zun_context.RequestContext(*args, **kwargs)
            return zun_context.RequestContext.from_dict(context.to_dict())

        p = mock.patch.object(zun_context, 'make_context',
                              side_effect=make_context)
        self.mock_make_context = p.start()
        self.addCleanup(p.stop)

        self.policy = self.useFixture(policy_fixture.PolicyFixture())
        self.useFixture(conf_fixture.ConfFixture())

        self._base_test_obj_backup = copy.copy(
            objects_base.ZunObjectRegistry._registry._obj_classes)
        self.addCleanup(self._restore_obj_registry)

        def reset_pecan():
            pecan.set_config({}, overwrite=True)

        self.addCleanup(reset_pecan) 
開發者ID:openstack,項目名稱:zun,代碼行數:50,代碼來源:base.py


注:本文中的pecan.set_config方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。