diff options
| author | Aymeric Augustin | 2013-10-26 14:06:21 +0200 |
|---|---|---|
| committer | Aymeric Augustin | 2013-10-26 14:15:23 +0200 |
| commit | 8525bfc7fb2e868edf24fb5c6fea00bc871d7489 (patch) | |
| tree | 548b38900a9d1ba0c8b189fd6642936278f366b6 /tests | |
| parent | 3a5492b471d907bdb66c627914264ee1f2d4e537 (diff) | |
| download | django-debug-toolbar-8525bfc7fb2e868edf24fb5c6fea00bc871d7489.tar.bz2 | |
Don't crash on non ascii bytestrings in db params.
Thanks Karen Tracey for the report. Fix #422.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/tests.py | 4 | ||||
| -rw-r--r-- | tests/urls.py | 3 | ||||
| -rw-r--r-- | tests/views.py | 4 |
3 files changed, 9 insertions, 2 deletions
diff --git a/tests/tests.py b/tests/tests.py index 3c28f79..7fb4a87 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -169,6 +169,10 @@ class DebugToolbarIntegrationTestCase(TestCase): self.assertContains(response, 'LÀTÍN') # template self.assertContains(response, 'djDebug') # toolbar + def test_non_ascii_bytes_in_db_params(self): + response = self.client.get('/non_ascii_bytes_in_db_params/') + self.assertContains(response, 'djàngó') + def test_non_ascii_session(self): response = self.client.get('/set_session/') self.assertContains(response, 'où') diff --git a/tests/urls.py b/tests/urls.py index 4bed492..8a88385 100644 --- a/tests/urls.py +++ b/tests/urls.py @@ -1,3 +1,5 @@ +# coding: utf-8 + """ URLpatterns for the debug toolbar. @@ -22,6 +24,7 @@ urlpatterns = patterns('tests.views', url(r'^resolving3/(.+)/$', 'resolving_view', { 'arg2' : 'default' }), url(r'^regular/(?P<title>.*)/$', 'regular_view'), url(r'^non_ascii_context/$', 'non_ascii_context'), + url(r'^non_ascii_bytes_in_db_params/$', 'new_user', {'username': 'djàngó'.encode('utf-8')}), url(r'^non_ascii_request/$', 'regular_view', {'title': NonAsciiRepr()}), url(r'^new_user/$', 'new_user'), url(r'^execute_sql/$', 'execute_sql'), diff --git a/tests/views.py b/tests/views.py index e6d9ebb..01c4971 100644 --- a/tests/views.py +++ b/tests/views.py @@ -23,8 +23,8 @@ def regular_view(request, title): return render(request, 'basic.html', {'title': title}) -def new_user(request): - User.objects.create_user(username='joe') +def new_user(request, username='joe'): + User.objects.create_user(username=username) return render(request, 'basic.html', {'title': 'new user'}) |
