Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: Themanwithoutaplan/pyramid_debugtoolbar
base: 7af237d11c
...
head fork: Themanwithoutaplan/pyramid_debugtoolbar
compare: 71ec1e54b1
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 2 commit comments
  • 1 contributor
Commits on Mar 14, 2012
Charlie Clark Added test stub for actually testing query 'deque' 91163b7
Commits on Mar 15, 2012
Charlie Clark Added support for actually setting the maxlength 71ec1e5
Showing with 45 additions and 6 deletions.
  1. +45 −6 pyramid_debugtoolbar/panels/tests/test_sqla.py
View
51 pyramid_debugtoolbar/panels/tests/test_sqla.py
@@ -3,23 +3,24 @@
from pyramid import testing
class TestSQLAPanel(unittest.TestCase):
+
def setUp(self):
- self.config = testing.setUp()
+ self.request = testing.DummyRequest()
+ self.config = testing.setUp(request=self.request)
def tearDown(self):
testing.tearDown()
-
+
def _makeOne(self):
from pyramid_debugtoolbar.panels.sqla import SQLADebugPanel
- request = testing.DummyRequest()
- return SQLADebugPanel(request)
-
+ return SQLADebugPanel(self.request)
+
def test_max_queries(self):
panel = self._makeOne()
self.assertEqual(panel.max_queries, None)
self.config.registry.settings['debugtoolbar.sqla_max_queries'] = '10'
self.assertEqual(panel.max_queries, '10')
-
+
def test_nav_subtitle(self):
panel = self._makeOne()
self.assertEqual(panel.nav_subtitle(), None)
@@ -27,3 +28,41 @@ def test_nav_subtitle(self):
self.assertEqual(panel.nav_subtitle(), '1 query ')
self.config.registry.settings['debugtoolbar.sqla_max_queries'] = '10'
self.assertEqual(panel.nav_subtitle(), '1 query (10 max)')
+
+
+class Test_after_cursor_execute(unittest.TestCase):
+
+ def setUp(self):
+ self.request = testing.DummyRequest()
+ self.config = testing.setUp(request=self.request)
+
+ def tearDown(self):
+ testing.tearDown()
+
+ def _makeOne(self):
+ from pyramid_debugtoolbar.panels.sqla import _after_cursor_execute
+ _after_cursor_execute(DummyConnection(), None, None, None, None, None)
+
+ def test_no_max_queries(self):
+ self._makeOne()
+ self.assertEqual(self.request.registry.settings.get(
+ 'debugtoolbar.sqla_max_queries'), None)
+ self.assertEqual(self.request.pdtb_sqla_queries.maxlen, None)
+
+ def test_max_queries(self):
+ self.request.registry.settings['debugtoolbar.sqla_max_queries'] = '10'
+ self.assertEqual(self.request.registry.settings.get(
+ 'debugtoolbar.sqla_max_queries'), '10')
+ self._makeOne()
+ self.assertEqual(self.request.pdtb_sqla_queries.maxlen, 10)
+
+
+class DummyConnection(object):
+ """Dummy Database Connection"""
+
+ def __init__(self):
+ import time
+ self.pdtb_start_timer = time.time()
+
+ def engine(self):
+ pass

Showing you all comments on commits in this comparison.

@marcofalcioni
Collaborator

Hi Charlie, how do I get a hold of you?

@Themanwithoutaplan
Something went wrong with that request. Please try again.