本文整理匯總了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()