diff --git a/debug_toolbar/panels/staticfiles.py b/debug_toolbar/panels/staticfiles.py index fb2cdd093..1dc61c1e4 100644 --- a/debug_toolbar/panels/staticfiles.py +++ b/debug_toolbar/panels/staticfiles.py @@ -11,7 +11,7 @@ from debug_toolbar import panels -@dataclass(eq=True, frozen=True) +@dataclass(eq=True, frozen=True, order=True) class StaticFile: """ Representing the different properties of a static file. diff --git a/tests/panels/test_staticfiles.py b/tests/panels/test_staticfiles.py index 81afe6afa..9af7e5bf8 100644 --- a/tests/panels/test_staticfiles.py +++ b/tests/panels/test_staticfiles.py @@ -65,19 +65,25 @@ def test_insert_content(self): def test_path(self): def get_response(request): - # template contains one static file return render( request, "staticfiles/path.html", - {"path": Path("additional_static/base.css")}, + { + "paths": [ + Path("additional_static/base.css"), + Path("additional_static/base.css"), + Path("additional_static/base2.css"), + ] + }, ) self._get_response = get_response request = RequestFactory().get("/") response = self.panel.process_request(request) self.panel.generate_stats(self.request, response) - self.assertEqual(self.panel.get_stats()["num_used"], 1) - self.assertIn('"/static/additional_static/base.css"', self.panel.content) + self.assertEqual(self.panel.get_stats()["num_used"], 2) + self.assertIn('"/static/additional_static/base.css"', self.panel.content, 1) + self.assertIn('"/static/additional_static/base2.css"', self.panel.content, 1) def test_storage_state_preservation(self): """Ensure the URLMixin doesn't affect storage state""" diff --git a/tests/templates/staticfiles/path.html b/tests/templates/staticfiles/path.html index 9e9ff1b88..d56123afb 100644 --- a/tests/templates/staticfiles/path.html +++ b/tests/templates/staticfiles/path.html @@ -1,3 +1 @@ -{% load static %} -{# A single file used twice #} -{% static path %}{% static path %} +{% load static %}{% for path in paths %}{% static path %}{% endfor %}
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: