aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJannis Leidel2013-03-02 14:09:30 +0100
committerJannis Leidel2013-03-02 14:09:30 +0100
commit0844c8b24527486d43f8ab18241ce0b7f900129b (patch)
treed9db1cd777ee7b122665b5358c0b1d24d30f93a7 /tests
parent42d7dde77e1c2daffaa5fa5bd16184f52c413c20 (diff)
parent54f4f3a7361ae711641b511df5a4c8962ad623a4 (diff)
downloaddjango-debug-toolbar-0844c8b24527486d43f8ab18241ce0b7f900129b.tar.bz2
Merge branch 'issue_230' of git://github.com/akaariai/django-debug-toolbar into akaariai-issue_230
Conflicts: debug_toolbar/utils/tracking/db.py
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/tests.py b/tests/tests.py
index ea2938d..a3618bf 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -2,9 +2,11 @@ import thread
from django.conf import settings
from django.contrib.auth.models import User
+from django.db import connection
from django.http import HttpResponse
from django.test import TestCase, RequestFactory
from django.template import Template, Context
+from django.utils import unittest
from debug_toolbar.middleware import DebugToolbarMiddleware
from debug_toolbar.panels.sql import SQLDebugPanel
@@ -214,6 +216,19 @@ class SQLPanelTestCase(BaseTestCase):
# ensure the stacktrace is populated
self.assertTrue(len(query[1]['stacktrace']) > 0)
+ @unittest.skipUnless(connection.vendor=='postgresql',
+ 'Test valid only on PostgreSQL')
+ def test_erroneous_query(self):
+ """
+ Test that an error in the query isn't swallowed by the middleware.
+ """
+ from django.db import connection
+ from django.db.utils import DatabaseError
+ try:
+ connection.cursor().execute("erroneous query")
+ except DatabaseError as e:
+ self.assertTrue('erroneous query' in str(e))
+
def test_disable_stacktraces(self):
panel = self.toolbar.get_panel(SQLDebugPanel)
self.assertEquals(len(panel._queries), 0)