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


Python test.modify_settings方法代碼示例

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


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

示例1: setUp

# 需要導入模塊: from django import test [as 別名]
# 或者: from django.test import modify_settings [as 別名]
def setUp(self):
        super(MultipleEngineTests, self).setUp()

        engine = {
            'NAME': 'other',
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'DIRS': ['templates2'],         # where the tests put things.
            'OPTIONS': {
                'debug': True,
            },
        }
        modified_settings = modify_settings(TEMPLATES={'append': [engine]})
        modified_settings.enable()
        self.addCleanup(modified_settings.disable)

        self.template_directory = 'templates2' 
開發者ID:nedbat,項目名稱:django_coverage_plugin,代碼行數:18,代碼來源:test_engines.py

示例2: render_to_response

# 需要導入模塊: from django import test [as 別名]
# 或者: from django.test import modify_settings [as 別名]
def render_to_response(self, context, **response_kwargs):
        self.response_class.modify_settings = modify_settings(
            MENU_ITEMS={'append': [
                ('...', [
                    (
                        _('Edit'),
                        reverse('testcases-edit', args=[self.object.pk])
                    ),
                    (
                        _('Clone'),
                        reverse('testcases-clone') + "?case=%d" % self.object.pk
                    ),
                    (
                        _('History'),
                        "/admin/testcases/testcase/%d/history/" % self.object.pk
                    ),
                    ('-', '-'),
                    (
                        _('Delete'),
                        reverse('admin:testcases_testcase_delete', args=[self.object.pk])
                    )])]}
        )
        return super().render_to_response(context, **response_kwargs) 
開發者ID:kiwitcms,項目名稱:Kiwi,代碼行數:25,代碼來源:views.py

示例3: render_to_response

# 需要導入模塊: from django import test [as 別名]
# 或者: from django.test import modify_settings [as 別名]
def render_to_response(self, context, **response_kwargs):
        self.response_class.modify_settings = modify_settings(
            MENU_ITEMS={'append': [
                ('...', [
                    (
                        _('Edit'),
                        reverse('bugs-edit', args=[self.object.pk])
                    ),
                    ('-', '-'),
                    (
                        _('Delete'),
                        reverse('admin:bugs_bug_delete', args=[self.object.pk])
                    ),
                ])
            ]}
        )
        return super().render_to_response(context, **response_kwargs) 
開發者ID:kiwitcms,項目名稱:Kiwi,代碼行數:19,代碼來源:views.py

示例4: test_third_engine_not_debug

# 需要導入模塊: from django import test [as 別名]
# 或者: from django.test import modify_settings [as 別名]
def test_third_engine_not_debug(self):
        engine3 = {
            'NAME': 'notdebug',
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'DIRS': ['templates3'],         # where the tests put things.
        }
        modified_settings = modify_settings(TEMPLATES={'append': [engine3]})
        modified_settings.enable()
        self.addCleanup(modified_settings.disable)

        self.make_template('Hello')
        with self.assert_plugin_disabled("Template debugging must be enabled in settings."):
            self.run_django_coverage() 
開發者ID:nedbat,項目名稱:django_coverage_plugin,代碼行數:15,代碼來源:test_engines.py

示例5: setUp

# 需要導入模塊: from django import test [as 別名]
# 或者: from django.test import modify_settings [as 別名]
def setUp(self):
        self.patched_settings = modify_settings(
            AUTHENTICATION_BACKENDS={'append': self.backend},
            MIDDLEWARE={'append': self.middleware},
        )
        self.patched_settings.enable() 
開發者ID:nesdis,項目名稱:djongo,代碼行數:8,代碼來源:test_remote_user.py


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