Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Modernized views.DebugViewTests

  • Loading branch information...
commit b1fb6f48201e00c6ea0eae37a839525657cf71e2 1 parent 93e6733
Claude Paroz authored September 15, 2012
21  tests/regressiontests/views/tests/debug.py
... ...
@@ -1,36 +1,27 @@
1  
-from __future__ import absolute_import
  1
+from __future__ import absolute_import, unicode_literals
2 2
 
3 3
 import inspect
4 4
 import os
5 5
 import sys
6 6
 
7 7
 from django.conf import settings
  8
+from django.core import mail
8 9
 from django.core.files.uploadedfile import SimpleUploadedFile
9  
-from django.test import TestCase, RequestFactory
10  
-from django.test.utils import (setup_test_template_loader,
11  
-                               restore_template_loaders)
12 10
 from django.core.urlresolvers import reverse
  11
+from django.test import TestCase, RequestFactory
  12
+from django.test.utils import (override_settings, setup_test_template_loader,
  13
+    restore_template_loaders)
13 14
 from django.views.debug import ExceptionReporter
14  
-from django.core import mail
15 15
 
16 16
 from .. import BrokenException, except_args
17 17
 from ..views import (sensitive_view, non_sensitive_view, paranoid_view,
18 18
     custom_exception_reporter_filter_view, sensitive_method_view)
19 19
 
20 20
 
  21
+@override_settings(DEBUG=True, TEMPLATE_DEBUG=True)
21 22
 class DebugViewTests(TestCase):
22 23
     urls = "regressiontests.views.urls"
23 24
 
24  
-    def setUp(self):
25  
-        self.old_debug = settings.DEBUG
26  
-        settings.DEBUG = True
27  
-        self.old_template_debug = settings.TEMPLATE_DEBUG
28  
-        settings.TEMPLATE_DEBUG = True
29  
-
30  
-    def tearDown(self):
31  
-        settings.DEBUG = self.old_debug
32  
-        settings.TEMPLATE_DEBUG = self.old_template_debug
33  
-
34 25
     def test_files(self):
35 26
         response = self.client.get('/raises/')
36 27
         self.assertEqual(response.status_code, 500)

0 notes on commit b1fb6f4

Please sign in to comment.
Something went wrong with that request. Please try again.