diff options
| author | Aymeric Augustin | 2013-12-14 12:47:28 -0800 | 
|---|---|---|
| committer | Aymeric Augustin | 2013-12-14 12:47:28 -0800 | 
| commit | dbed3e7c72f930c285f17206879f6bd1d46f67a1 (patch) | |
| tree | 317b063328fab25298262db1e7ae81ad50282a4a /tests | |
| parent | 59e4931d5880ed24cb49734e81c7ed538c98fa45 (diff) | |
| parent | bdbe57d6e13241f852860336f55bca0d88bd4384 (diff) | |
| download | django-debug-toolbar-dbed3e7c72f930c285f17206879f6bd1d46f67a1.tar.bz2 | |
Merge pull request #494 from django-debug-toolbar/staticfiles
Added staticfiles panel class.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/additional_static/base.css | 3 | ||||
| -rw-r--r-- | tests/panels/test_staticfiles.py | 28 | ||||
| -rw-r--r-- | tests/settings.py | 7 | ||||
| -rw-r--r-- | tests/tests.py | 13 | 
4 files changed, 38 insertions, 13 deletions
| diff --git a/tests/additional_static/base.css b/tests/additional_static/base.css new file mode 100644 index 0000000..8d7d127 --- /dev/null +++ b/tests/additional_static/base.css @@ -0,0 +1,3 @@ +body { +    color: green; +}
\ No newline at end of file diff --git a/tests/panels/test_staticfiles.py b/tests/panels/test_staticfiles.py new file mode 100644 index 0000000..70a7b96 --- /dev/null +++ b/tests/panels/test_staticfiles.py @@ -0,0 +1,28 @@ +# coding: utf-8 + +from __future__ import absolute_import, unicode_literals + +from django.conf import settings + +from ..base import BaseTestCase + + +class StaticFilesPanelTestCase(BaseTestCase): + +    def setUp(self): +        super(StaticFilesPanelTestCase, self).setUp() +        self.panel = self.toolbar.get_panel_by_id('StaticFilesPanel') + +    def test_default_case(self): +        self.panel.process_request(self.request) +        self.panel.process_response(self.request, self.response) +        self.assertIn('django.contrib.staticfiles.finders.' +                      'AppDirectoriesFinder', self.panel.content) +        self.assertIn('django.contrib.staticfiles.finders.' +                      'FileSystemFinder (1 file)', self.panel.content) +        self.assertEqual(self.panel.num_used, 0) +        self.assertNotEqual(self.panel.num_found, 0) +        self.assertEqual(self.panel.get_staticfiles_apps(), +                         ['django.contrib.admin', 'debug_toolbar']) +        self.assertEqual(self.panel.get_staticfiles_dirs(), +                         settings.STATICFILES_DIRS) diff --git a/tests/settings.py b/tests/settings.py index 24e0cd4..68346ff 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -1,6 +1,8 @@  """Django settings for tests."""  import os +import django +  BASE_DIR = os.path.dirname(os.path.dirname(__file__)) @@ -40,6 +42,8 @@ ROOT_URLCONF = 'tests.urls'  STATIC_URL = '/static/' +STATICFILES_DIRS = [os.path.join(BASE_DIR, 'tests', 'additional_static')] +  # Cache and database @@ -62,3 +66,6 @@ DEBUG_TOOLBAR_CONFIG = {      # Django's test client sets wsgi.multiprocess to True inappropriately      'RENDER_PANELS': False,  } + +if django.VERSION[:2] < (1, 6): +    TEST_RUNNER = 'discover_runner.DiscoverRunner' diff --git a/tests/tests.py b/tests/tests.py deleted file mode 100644 index 1818fe7..0000000 --- a/tests/tests.py +++ /dev/null @@ -1,13 +0,0 @@ -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_logging import *                                  # noqa -    from .panels.test_profiling import *                                # noqa -    from .panels.test_redirects 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 -    from .test_utils import *                                           # noqa | 
