aboutsummaryrefslogtreecommitdiffstats
path: root/tests/panels/test_staticfiles.py
blob: 6b3128a80f4df2844f2f3c4ea32e24196252a991 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# coding: utf-8

from __future__ import absolute_import, unicode_literals

from django.conf import settings
from django.contrib.staticfiles.templatetags import staticfiles
from django.template import Context, RequestContext, Template

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.assertEqual(self.panel.num_found, 88)
        self.assertEqual(self.panel.get_staticfiles_apps(),
                         ['django.contrib.admin', 'debug_toolbar'])
        self.assertEqual(self.panel.get_staticfiles_dirs(),
                         settings.STATICFILES_DIRS)