summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHiroki KIYOHARA <hirokiky@gmail.com>2014-07-26 12:06:48 +0200
committerHiroki KIYOHARA <hirokiky@gmail.com>2014-07-26 12:35:51 +0200
commitd0889863de50d65659f56f0b9ea0672a8b6482a1 (patch)
tree91dd500ab81b9f25f115e61f81fe5876622ef893 /tests
parente569144910e336d2f76a3a31998ec672377d31cc (diff)
Fixed code to solve #23070 problem
Added a class to wrap callable in settings: * Not to call in the debug page (#21345). * Not to break the debug page if the callable forbidding to set attributes (#23070). Thanks @bmispelon for giving me some advice.
Diffstat (limited to 'tests')
-rw-r--r--tests/view_tests/tests/test_debug.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py
index b41ce8b75c..3d51da9f94 100644
--- a/tests/view_tests/tests/test_debug.py
+++ b/tests/view_tests/tests/test_debug.py
@@ -20,7 +20,7 @@ from django.test import TestCase, RequestFactory, override_settings
from django.test.utils import override_with_test_loader
from django.utils.encoding import force_text, force_bytes
from django.utils import six
-from django.views.debug import ExceptionReporter
+from django.views.debug import CallableSettingWrapper, ExceptionReporter
from .. import BrokenException, except_args
from ..views import (sensitive_view, non_sensitive_view, paranoid_view,
@@ -29,6 +29,21 @@ from ..views import (sensitive_view, non_sensitive_view, paranoid_view,
multivalue_dict_key_error)
+class CallableSettingWrapperTests(TestCase):
+ """ Unittests for CallableSettingWrapper
+ """
+ def test_repr(self):
+ class WrappedCallable(object):
+ def __repr__(self):
+ return "repr from the wrapped callable"
+
+ def __call__(self):
+ pass
+
+ actual = repr(CallableSettingWrapper(WrappedCallable()))
+ self.assertEqual(actual, "repr from the wrapped callable")
+
+
@override_settings(DEBUG=True, TEMPLATE_DEBUG=True,
ROOT_URLCONF="view_tests.urls")
class DebugViewTests(TestCase):