• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python settings.apply_settings函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中third_party_auth.settings.apply_settings函数的典型用法代码示例。如果您正苦于以下问题:Python apply_settings函数的具体用法?Python apply_settings怎么用?Python apply_settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了apply_settings函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_apply_settings_prepends_auth_backends

 def test_apply_settings_prepends_auth_backends(self):
     self.assertEqual(_ORIGINAL_AUTHENTICATION_BACKENDS, self.settings.AUTHENTICATION_BACKENDS)
     settings.apply_settings({provider.GoogleOauth2.NAME: {}, provider.MozillaPersona.NAME: {}}, self.settings)
     self.assertEqual((
         provider.GoogleOauth2.AUTHENTICATION_BACKEND, provider.MozillaPersona.AUTHENTICATION_BACKEND) +
         _ORIGINAL_AUTHENTICATION_BACKENDS,
         self.settings.AUTHENTICATION_BACKENDS)
开发者ID:BeiLuoShiMen,项目名称:edx-platform,代码行数:7,代码来源:test_settings.py


示例2: test_apply_settings_prepends_auth_backends

 def test_apply_settings_prepends_auth_backends(self):
     self.assertEqual(_ORIGINAL_AUTHENTICATION_BACKENDS, self.settings.AUTHENTICATION_BACKENDS)
     settings.apply_settings({provider.GoogleOauth2.NAME: {}, provider.LinkedInOauth2.NAME: {}}, self.settings)
     self.assertEqual((
         provider.GoogleOauth2.get_authentication_backend(), provider.LinkedInOauth2.get_authentication_backend()) +
         _ORIGINAL_AUTHENTICATION_BACKENDS,
         self.settings.AUTHENTICATION_BACKENDS)
开发者ID:CDOT-EDX,项目名称:edx-platform,代码行数:7,代码来源:test_settings.py


示例3: _enable_third_party_auth

 def _enable_third_party_auth(self):
     """
     Enable the use of third_party_auth, which allows users to sign in to edX
     using other identity providers. For configuration details, see
     common/djangoapps/third_party_auth/settings.py.
     """
     from third_party_auth import settings as auth_settings
     auth_settings.apply_settings(settings)
开发者ID:AlexxNica,项目名称:edx-platform,代码行数:8,代码来源:apps.py


示例4: test_apply_settings_raises_value_error_if_provider_contains_uninitialized_setting

 def test_apply_settings_raises_value_error_if_provider_contains_uninitialized_setting(self):
     bad_setting_name = 'bad_setting'
     self.assertNotIn('bad_setting_name', provider.GoogleOauth2.SETTINGS)
     auth_info = {
         provider.GoogleOauth2.NAME: {
             bad_setting_name: None,
         },
     }
     with self.assertRaisesRegexp(ValueError, '^.*not initialized$'):
         settings.apply_settings(auth_info, self.settings)
开发者ID:CDOT-EDX,项目名称:edx-platform,代码行数:10,代码来源:test_settings.py


示例5: test_apply_settings_initializes_stubs_and_merges_settings_from_auth_info

    def test_apply_settings_initializes_stubs_and_merges_settings_from_auth_info(self):
        for key in provider.GoogleOauth2.SETTINGS:
            self.assertFalse(hasattr(self.settings, key))

        auth_info = {
            provider.GoogleOauth2.NAME: {
                'SOCIAL_AUTH_GOOGLE_OAUTH2_KEY': 'google_oauth2_key',
            },
        }
        settings.apply_settings(auth_info, self.settings)
        self.assertEqual('google_oauth2_key', self.settings.SOCIAL_AUTH_GOOGLE_OAUTH2_KEY)
        self.assertIsNone(self.settings.SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET)
开发者ID:CDOT-EDX,项目名称:edx-platform,代码行数:12,代码来源:test_settings.py


示例6: run

def run():
    """
    Executed during django startup
    """
    django_utils_translation.patch()

    autostartup()

    add_mimetypes()

    if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH', False):
        from third_party_auth import settings as auth_settings
        auth_settings.apply_settings(settings)

    if settings.FEATURES.get('USE_CUSTOM_THEME', False):
        enable_theme()
开发者ID:miptliot,项目名称:edx-platform,代码行数:16,代码来源:startup.py


示例7: test_apply_settings_adds_exception_middleware

 def test_apply_settings_adds_exception_middleware(self):
     settings.apply_settings(self.settings)
     self.assertIn('third_party_auth.middleware.ExceptionMiddleware', self.settings.MIDDLEWARE_CLASSES)
开发者ID:cpennington,项目名称:edx-platform,代码行数:3,代码来源:test_settings.py


示例8: configure_runtime

 def configure_runtime(self):
     """Configures settings details."""
     auth_settings.apply_settings({self.PROVIDER_CLASS.NAME: self.PROVIDER_SETTINGS}, django_settings)
     # Force settings to propagate into cached members on
     # social.apps.django_app.utils.
     reload(social_utils)
开发者ID:Cgruppo,项目名称:edx-platform,代码行数:6,代码来源:base.py


示例9: test_apply_settings_adds_third_party_auth_to_installed_apps

 def test_apply_settings_adds_third_party_auth_to_installed_apps(self):
     settings.apply_settings({}, self.settings)
     self.assertIn('third_party_auth', self.settings.INSTALLED_APPS)
开发者ID:CDOT-EDX,项目名称:edx-platform,代码行数:3,代码来源:test_settings.py


示例10: test_apply_settings_enables_no_providers_and_completes_when_app_info_empty

 def test_apply_settings_enables_no_providers_and_completes_when_app_info_empty(self):
     settings.apply_settings({}, self.settings)
     self.assertEqual([], provider.Registry.enabled())
开发者ID:CDOT-EDX,项目名称:edx-platform,代码行数:3,代码来源:test_settings.py


示例11: test_apply_settings_adds_exception_middleware

 def test_apply_settings_adds_exception_middleware(self):
     settings.apply_settings({}, self.settings)
     for middleware_name in settings._MIDDLEWARE_CLASSES:
         self.assertIn(middleware_name, self.settings.MIDDLEWARE_CLASSES)
开发者ID:CDOT-EDX,项目名称:edx-platform,代码行数:4,代码来源:test_settings.py


示例12: test_apply_settings_adds_fields_stored_in_session

 def test_apply_settings_adds_fields_stored_in_session(self):
     settings.apply_settings({}, self.settings)
     self.assertEqual(settings._FIELDS_STORED_IN_SESSION, self.settings.FIELDS_STORED_IN_SESSION)
开发者ID:CDOT-EDX,项目名称:edx-platform,代码行数:3,代码来源:test_settings.py


示例13: test_can_enable_linkedin_oauth2

 def test_can_enable_linkedin_oauth2(self):
     auth_settings.apply_settings({'LinkedIn': {'SOCIAL_AUTH_LINKEDIN_OAUTH2_KEY': 'linkedin_key'}}, settings)
     self.assertEqual([provider.LinkedInOauth2], provider.Registry.enabled())
     self.assertEqual('linkedin_key', settings.SOCIAL_AUTH_LINKEDIN_OAUTH2_KEY)
开发者ID:BeiLuoShiMen,项目名称:edx-platform,代码行数:4,代码来源:test_settings_integration.py


示例14: test_can_enable_mozilla_persona

 def test_can_enable_mozilla_persona(self):
     auth_settings.apply_settings({'Mozilla Persona': {}}, settings)
     self.assertEqual([provider.MozillaPersona], provider.Registry.enabled())
开发者ID:BeiLuoShiMen,项目名称:edx-platform,代码行数:3,代码来源:test_settings_integration.py


示例15: test_apply_settings_adds_fields_stored_in_session

 def test_apply_settings_adds_fields_stored_in_session(self):
     settings.apply_settings(self.settings)
     self.assertEqual(['auth_entry', 'next'], self.settings.FIELDS_STORED_IN_SESSION)
开发者ID:cpennington,项目名称:edx-platform,代码行数:3,代码来源:test_settings.py


示例16: test_apply_settings_turns_off_redirect_sanitization

 def test_apply_settings_turns_off_redirect_sanitization(self):
     settings.apply_settings(self.settings)
     self.assertFalse(self.settings.SOCIAL_AUTH_SANITIZE_REDIRECTS)
开发者ID:cpennington,项目名称:edx-platform,代码行数:3,代码来源:test_settings.py


示例17: test_apply_settings_enables_no_providers_by_default

 def test_apply_settings_enables_no_providers_by_default(self):
     # Providers are only enabled via ConfigurationModels in the database
     settings.apply_settings(self.settings)
     self.assertEqual([], provider.Registry.enabled())
开发者ID:189140879,项目名称:edx-platform,代码行数:4,代码来源:test_settings.py


示例18: test_enterprise_elements_inserted

 def test_enterprise_elements_inserted(self):
     settings.apply_settings(self.settings)
     self.assertIn('enterprise.tpa_pipeline.set_data_sharing_consent_record', self.settings.SOCIAL_AUTH_PIPELINE)
     self.assertIn('enterprise.tpa_pipeline.verify_data_sharing_consent', self.settings.SOCIAL_AUTH_PIPELINE)
开发者ID:CredoReference,项目名称:edx-platform,代码行数:4,代码来源:test_settings.py


示例19: test_apply_settings_turns_off_raising_social_exceptions

 def test_apply_settings_turns_off_raising_social_exceptions(self):
     # Guard against submitting a conf change that's convenient in dev but
     # bad in prod.
     settings.apply_settings({}, self.settings)
     self.assertFalse(self.settings.SOCIAL_AUTH_RAISE_EXCEPTIONS)
开发者ID:CDOT-EDX,项目名称:edx-platform,代码行数:5,代码来源:test_settings.py


示例20: test_can_enable_google_oauth2

 def test_can_enable_google_oauth2(self):
     auth_settings.apply_settings({'Google': {'SOCIAL_AUTH_GOOGLE_OAUTH2_KEY': 'google_key'}}, settings)
     self.assertEqual([provider.GoogleOauth2], provider.Registry.enabled())
     self.assertEqual('google_key', settings.SOCIAL_AUTH_GOOGLE_OAUTH2_KEY)
开发者ID:BeiLuoShiMen,项目名称:edx-platform,代码行数:4,代码来源:test_settings_integration.py



注:本文中的third_party_auth.settings.apply_settings函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python bottle.abort函数代码示例发布时间:2022-05-27
下一篇:
Python pipeline.get_provider_user_states函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap