From d2248d7a8532ed6758b08282f9327e2926aebe4d Mon Sep 17 00:00:00 2001 From: bkonkle Date: Fri, 9 Sep 2011 10:16:21 -0700 Subject: Set INTERNAL_IPS and DEBUG on the middleware test --- tests/tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/tests.py') diff --git a/tests/tests.py b/tests/tests.py index 60620bb..40722ba 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -49,7 +49,8 @@ class DebugToolbarTestCase(BaseTestCase): urls = 'tests.urls' def test_middleware(self): - resp = self.client.get('/execute_sql/') + with Settings(INTERNAL_IPS=['127.0.0.1'], DEBUG=True): + resp = self.client.get('/execute_sql/') self.assertEquals(resp.status_code, 200) def test_show_toolbar_DEBUG(self): -- cgit v1.2.3 From fa317b6758107bf2e75f30c5f86cae280d26ebaa Mon Sep 17 00:00:00 2001 From: bkonkle Date: Mon, 12 Sep 2011 12:38:22 -0500 Subject: Added response processing into the tests, since that is now required to generate stats --- tests/tests.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/tests.py') diff --git a/tests/tests.py b/tests/tests.py index 40722ba..b03e167 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -38,12 +38,15 @@ class Settings(object): class BaseTestCase(TestCase): def setUp(self): request = Dingus('request') + response = Dingus('response') toolbar = DebugToolbar(request) DebugToolbarMiddleware.debug_toolbars[thread.get_ident()] = toolbar self.request = request + self.response = response self.toolbar = toolbar + self.toolbar.stats = {} class DebugToolbarTestCase(BaseTestCase): urls = 'tests.urls' @@ -144,6 +147,7 @@ class DebugToolbarTestCase(BaseTestCase): def test_with_process_view(self): request = self.request + response = self.response def _test_view(request): return HttpResponse('') @@ -152,15 +156,18 @@ class DebugToolbarTestCase(BaseTestCase): panel = self.toolbar.get_panel(RequestVarsDebugPanel) panel.process_request(request) panel.process_view(request, _test_view, [], {}) + panel.process_response(request, response) content = panel.content() self.assertTrue('tests.tests._test_view' in content, content) def test_without_process_view(self): request = self.request + response = self.response with Settings(DEBUG=True): panel = self.toolbar.get_panel(RequestVarsDebugPanel) panel.process_request(request) + panel.process_response(request, response) content = panel.content() self.assertTrue('<no view>' in content, content) -- cgit v1.2.3