diff options
| author | Aymeric Augustin | 2013-11-24 10:42:43 +0100 | 
|---|---|---|
| committer | Aymeric Augustin | 2013-11-24 11:01:44 +0100 | 
| commit | fe3df822111d3b56000deca354b0bceed7bde9cc (patch) | |
| tree | 8fe21689037cd975f83e7f70480b96e0ba2e3b6a /tests | |
| parent | 7d24008ac3d70796c1502215c665311d2f21d6fd (diff) | |
| download | django-debug-toolbar-fe3df822111d3b56000deca354b0bceed7bde9cc.tar.bz2 | |
Rename all panels consistently.
Enforce absolute imports to avoid clashing with built-in package names.
Thanks Jannis for his feedback.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/base.py | 2 | ||||
| -rw-r--r-- | tests/commands/test_debugsqlshell.py | 2 | ||||
| -rw-r--r-- | tests/models.py | 2 | ||||
| -rw-r--r-- | tests/panels/test_cache.py | 4 | ||||
| -rw-r--r-- | tests/panels/test_logging.py (renamed from tests/panels/test_logger.py) | 4 | ||||
| -rw-r--r-- | tests/panels/test_profiling.py | 8 | ||||
| -rw-r--r-- | tests/panels/test_redirects.py | 4 | ||||
| -rw-r--r-- | tests/panels/test_request.py (renamed from tests/panels/test_request_vars.py) | 10 | ||||
| -rw-r--r-- | tests/panels/test_sql.py | 4 | ||||
| -rw-r--r-- | tests/panels/test_template.py | 12 | ||||
| -rw-r--r-- | tests/test_integration.py | 20 | ||||
| -rw-r--r-- | tests/test_utils.py | 2 | ||||
| -rw-r--r-- | tests/tests.py | 4 | ||||
| -rw-r--r-- | tests/urls.py | 2 | ||||
| -rw-r--r-- | tests/views.py | 2 | 
15 files changed, 41 insertions, 41 deletions
| diff --git a/tests/base.py b/tests/base.py index a1a59cc..78f3d6f 100644 --- a/tests/base.py +++ b/tests/base.py @@ -1,4 +1,4 @@ -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals  import threading diff --git a/tests/commands/test_debugsqlshell.py b/tests/commands/test_debugsqlshell.py index f35ef07..f0c88fa 100644 --- a/tests/commands/test_debugsqlshell.py +++ b/tests/commands/test_debugsqlshell.py @@ -1,4 +1,4 @@ -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals  import sys diff --git a/tests/models.py b/tests/models.py index 24358c0..78c1eb8 100644 --- a/tests/models.py +++ b/tests/models.py @@ -1,6 +1,6 @@  # coding: utf-8 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals  from django.utils import six diff --git a/tests/panels/test_cache.py b/tests/panels/test_cache.py index 42a6814..73b7e7c 100644 --- a/tests/panels/test_cache.py +++ b/tests/panels/test_cache.py @@ -1,6 +1,6 @@  # coding: utf-8 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals  from django.core import cache @@ -11,7 +11,7 @@ class CachePanelTestCase(BaseTestCase):      def setUp(self):          super(CachePanelTestCase, self).setUp() -        self.panel = self.toolbar.get_panel_by_id('CacheDebugPanel') +        self.panel = self.toolbar.get_panel_by_id('CachePanel')          self.panel.enable_instrumentation()      def tearDown(self): diff --git a/tests/panels/test_logger.py b/tests/panels/test_logging.py index f5fe375..342e673 100644 --- a/tests/panels/test_logger.py +++ b/tests/panels/test_logging.py @@ -1,8 +1,8 @@ -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals  import logging -from debug_toolbar.panels.logger import MESSAGE_IF_STRING_REPRESENTATION_INVALID +from debug_toolbar.panels.logging import MESSAGE_IF_STRING_REPRESENTATION_INVALID  from ..base import BaseTestCase diff --git a/tests/panels/test_profiling.py b/tests/panels/test_profiling.py index f6bb7d3..7ca7e7b 100644 --- a/tests/panels/test_profiling.py +++ b/tests/panels/test_profiling.py @@ -1,4 +1,4 @@ -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals  from django.contrib.auth.models import User  from django.db import IntegrityError, transaction @@ -17,12 +17,12 @@ from ..base import BaseTestCase  from ..views import regular_view -@override_settings(DEBUG_TOOLBAR_PANELS=['debug_toolbar.panels.profiling.ProfilingDebugPanel']) +@override_settings(DEBUG_TOOLBAR_PANELS=['debug_toolbar.panels.profiling.ProfilingPanel'])  class ProfilingPanelTestCase(BaseTestCase):      def setUp(self):          super(ProfilingPanelTestCase, self).setUp() -        self.panel = self.toolbar.get_panel_by_id('ProfilingDebugPanel') +        self.panel = self.toolbar.get_panel_by_id('ProfilingPanel')      def _test_render_with_or_without_line_profiler(self):          self.panel.process_view(self.request, regular_view, ('profiling',), {}) @@ -44,7 +44,7 @@ class ProfilingPanelTestCase(BaseTestCase):  @override_settings(DEBUG=True, -                   DEBUG_TOOLBAR_PANELS=['debug_toolbar.panels.profiling.ProfilingDebugPanel']) +                   DEBUG_TOOLBAR_PANELS=['debug_toolbar.panels.profiling.ProfilingPanel'])  class ProfilingPanelIntegrationTestCase(TestCase):      def test_view_executed_once(self): diff --git a/tests/panels/test_redirects.py b/tests/panels/test_redirects.py index 400cdcc..7e94e77 100644 --- a/tests/panels/test_redirects.py +++ b/tests/panels/test_redirects.py @@ -1,4 +1,4 @@ -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals  import django  from django.http import HttpResponse @@ -13,7 +13,7 @@ class RedirectsPanelTestCase(BaseTestCase):      def setUp(self):          super(RedirectsPanelTestCase, self).setUp() -        self.panel = self.toolbar.get_panel_by_id('InterceptRedirectsPanel') +        self.panel = self.toolbar.get_panel_by_id('RedirectsPanel')      def test_regular_response(self):          response = self.panel.process_response(self.request, self.response) diff --git a/tests/panels/test_request_vars.py b/tests/panels/test_request.py index a86956f..16843c4 100644 --- a/tests/panels/test_request_vars.py +++ b/tests/panels/test_request.py @@ -1,17 +1,17 @@  # coding: utf-8 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals  from django.utils import six  from ..base import BaseTestCase -class RequestVarsDebugPanelTestCase(BaseTestCase): +class RequestPanelTestCase(BaseTestCase):      def setUp(self): -        super(RequestVarsDebugPanelTestCase, self).setUp() -        self.panel = self.toolbar.get_panel_by_id('RequestVarsDebugPanel') +        super(RequestPanelTestCase, self).setUp() +        self.panel = self.toolbar.get_panel_by_id('RequestPanel')      def test_non_ascii_session(self):          self.request.session = {'où': 'où'} @@ -26,7 +26,7 @@ class RequestVarsDebugPanelTestCase(BaseTestCase):              self.assertIn('o\\xf9', content)              self.assertIn('l\\xc3\\xa0', content) -    def test_object_with_non_ascii_repr_in_request_vars(self): +    def test_object_with_non_ascii_repr_in_request_params(self):          self.request.path = '/non_ascii_request/'          self.panel.process_request(self.request)          self.panel.process_response(self.request, self.response) diff --git a/tests/panels/test_sql.py b/tests/panels/test_sql.py index 4a18a16..a6990a3 100644 --- a/tests/panels/test_sql.py +++ b/tests/panels/test_sql.py @@ -1,6 +1,6 @@  # coding: utf-8 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals  from django.contrib.auth.models import User  from django.db import connection @@ -14,7 +14,7 @@ class SQLPanelTestCase(BaseTestCase):      def setUp(self):          super(SQLPanelTestCase, self).setUp() -        self.panel = self.toolbar.get_panel_by_id('SQLDebugPanel') +        self.panel = self.toolbar.get_panel_by_id('SQLPanel')          self.panel.enable_instrumentation()      def tearDown(self): diff --git a/tests/panels/test_template.py b/tests/panels/test_template.py index 1c43982..8cb29f2 100644 --- a/tests/panels/test_template.py +++ b/tests/panels/test_template.py @@ -1,6 +1,6 @@  # coding: utf-8 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals  import django  from django.contrib.auth.models import User @@ -10,17 +10,17 @@ from ..base import BaseTestCase  from ..models import NonAsciiRepr -class TemplateDebugPanelTestCase(BaseTestCase): +class TemplatesPanelTestCase(BaseTestCase):      def setUp(self): -        super(TemplateDebugPanelTestCase, self).setUp() -        self.panel = self.toolbar.get_panel_by_id('TemplateDebugPanel') -        self.sql_panel = self.toolbar.get_panel_by_id('SQLDebugPanel') +        super(TemplatesPanelTestCase, self).setUp() +        self.panel = self.toolbar.get_panel_by_id('TemplatesPanel') +        self.sql_panel = self.toolbar.get_panel_by_id('SQLPanel')          self.sql_panel.enable_instrumentation()      def tearDown(self):          self.sql_panel.disable_instrumentation() -        super(TemplateDebugPanelTestCase, self).tearDown() +        super(TemplatesPanelTestCase, self).tearDown()      def test_queryset_hook(self):          t = Template("No context variables here!") diff --git a/tests/test_integration.py b/tests/test_integration.py index b903cb8..e92cab6 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -1,6 +1,6 @@  # coding: utf-8 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals  import os  from xml.etree import ElementTree as ET @@ -40,12 +40,12 @@ class DebugToolbarTestCase(BaseTestCase):              self.assertFalse(show_toolbar(self.request))      def _resolve_stats(self, path): -        # takes stats from RequestVars panel +        # takes stats from Request panel          self.request.path = path -        panel = self.toolbar.get_panel_by_id('RequestVarsDebugPanel') +        panel = self.toolbar.get_panel_by_id('RequestPanel')          panel.process_request(self.request)          panel.process_response(self.request, self.response) -        return self.toolbar.stats['requestvars'] +        return self.toolbar.stats['request']      def test_url_resolving_positional(self):          stats = self._resolve_stats('/resolving1/a/b/') @@ -120,14 +120,14 @@ class DebugToolbarLiveTestCase(LiveServerTestCase):      def test_basic(self):          self.selenium.get(self.live_server_url + '/regular/basic/') -        version_panel = self.selenium.find_element_by_id('VersionDebugPanel') +        version_panel = self.selenium.find_element_by_id('VersionsPanel') -        # Version panel isn't loaded +        # Versions panel isn't loaded          with self.assertRaises(NoSuchElementException):              version_panel.find_element_by_tag_name('table') -        # Click to show the version panel -        self.selenium.find_element_by_class_name('VersionDebugPanel').click() +        # Click to show the versions panel +        self.selenium.find_element_by_class_name('VersionsPanel').click()          # Version panel loads          table = WebDriverWait(self.selenium, timeout=10).until( @@ -138,10 +138,10 @@ class DebugToolbarLiveTestCase(LiveServerTestCase):      @override_settings(DEBUG_TOOLBAR_CONFIG={'RESULTS_CACHE_SIZE': 0})      def test_expired_storage(self):          self.selenium.get(self.live_server_url + '/regular/basic/') -        version_panel = self.selenium.find_element_by_id('VersionDebugPanel') +        version_panel = self.selenium.find_element_by_id('VersionsPanel')          # Click to show the version panel -        self.selenium.find_element_by_class_name('VersionDebugPanel').click() +        self.selenium.find_element_by_class_name('VersionsPanel').click()          # Version panel doesn't loads          error = WebDriverWait(self.selenium, timeout=10).until( diff --git a/tests/test_utils.py b/tests/test_utils.py index a930894..40e99be 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,4 +1,4 @@ -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals  from django.utils.unittest import TestCase diff --git a/tests/tests.py b/tests/tests.py index b08ac1c..1818fe7 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -3,10 +3,10 @@ import django  if django.VERSION[:2] < (1, 6):     # unittest-style discovery isn't available      from .commands.test_debugsqlshell import *                          # noqa      from .panels.test_cache import *                                    # noqa -    from .panels.test_logger import *                                   # noqa +    from .panels.test_logging import *                                  # noqa      from .panels.test_profiling import *                                # noqa      from .panels.test_redirects import *                                # noqa -    from .panels.test_request_vars import *                             # noqa +    from .panels.test_request import *                                  # noqa      from .panels.test_sql import *                                      # noqa      from .panels.test_template import *                                 # noqa      from .test_integration import *                                     # noqa diff --git a/tests/urls.py b/tests/urls.py index f297834..0a7ac19 100644 --- a/tests/urls.py +++ b/tests/urls.py @@ -1,6 +1,6 @@  # coding: utf-8 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals  from django.conf.urls import include, patterns, url  from django.contrib import admin diff --git a/tests/views.py b/tests/views.py index d7ff167..73e0087 100644 --- a/tests/views.py +++ b/tests/views.py @@ -1,6 +1,6 @@  # coding: utf-8 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals  from django.contrib.auth.models import User  from django.http import HttpResponse | 
