aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.py15
-rw-r--r--tests/urls.py12
-rw-r--r--tests/views.py9
3 files changed, 28 insertions, 8 deletions
diff --git a/tests/tests.py b/tests/tests.py
index 5390025..6883428 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -1,3 +1,5 @@
+# coding: utf-8
+
from __future__ import unicode_literals
import threading
@@ -161,6 +163,19 @@ class DebugToolbarTestCase(BaseTestCase):
self.assertEqual(stats['view_kwargs'], 'None')
self.assertEqual(stats['view_func'], '<no view>')
+ def test_non_utf8_charset(self):
+ with self.settings(DEBUG=True,
+ DEFAULT_CHARSET='iso-8859-1',
+ INTERNAL_IPS=['127.0.0.1']):
+
+ response = self.client.get('/regular/ASCII/')
+ self.assertContains(response, 'ASCII') # template
+ self.assertContains(response, 'djDebug') # toolbar
+
+ response = self.client.get('/regular/LÀTÍN/')
+ self.assertContains(response, 'LÀTÍN') # template
+ self.assertContains(response, 'djDebug') # toolbar
+
class DebugToolbarNameFromObjectTest(BaseTestCase):
def test_func(self):
diff --git a/tests/urls.py b/tests/urls.py
index 9c24c1e..4fb51c9 100644
--- a/tests/urls.py
+++ b/tests/urls.py
@@ -12,10 +12,10 @@ from django.contrib import admin
admin.autodiscover()
-urlpatterns = patterns('',
- # This pattern should be last to ensure tests still work
- url(r'^resolving1/(.+)/(.+)/$', 'tests.views.resolving_view', name='positional-resolving'),
- url(r'^resolving2/(?P<arg1>.+)/(?P<arg2>.+)/$', 'tests.views.resolving_view'),
- url(r'^resolving3/(.+)/$', 'tests.views.resolving_view', { 'arg2' : 'default' }),
- url(r'^execute_sql/$', 'tests.views.execute_sql'),
+urlpatterns = patterns('tests.views',
+ url(r'^resolving1/(.+)/(.+)/$', 'resolving_view', name='positional-resolving'),
+ url(r'^resolving2/(?P<arg1>.+)/(?P<arg2>.+)/$', 'resolving_view'),
+ url(r'^resolving3/(.+)/$', 'resolving_view', { 'arg2' : 'default' }),
+ url(r'^regular/(?P<title>.*)/$', 'regular_view'),
+ url(r'^execute_sql/$', 'execute_sql'),
)
diff --git a/tests/views.py b/tests/views.py
index ec9f30e..f756023 100644
--- a/tests/views.py
+++ b/tests/views.py
@@ -3,12 +3,17 @@ from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.http import HttpResponse
+
def execute_sql(request):
list(User.objects.all())
-
return HttpResponse()
+
+def regular_view(request, title='Test'):
+ content = '<html><head><title>%s</title><body></body></html>' % title
+ return HttpResponse(content)
+
+
def resolving_view(request, arg1, arg2):
# see test_url_resolving in tests.py
return HttpResponse()
-