本文整理汇总了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'
示例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)
示例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)
示例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()
示例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()