Skip to content

Commit

Permalink
Add test for number of queries!
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Jul 14, 2024
1 parent a897942 commit a3898e1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,13 @@ def test_mixin_factory(self):
self.assertContains(response, "cms.pagetree.css"),
# JS loadeD?
self.assertContains(response, "indicators.js")

def test_page_indicator_db_queries(self):
"""Only one query should be executed to get the indicator"""
version = PageVersionFactory(
content__language="en",
)
with self.assertNumQueries(1):
from djangocms_versioning.indicators import content_indicator, content_indicator_menu

Check failure on line 229 in tests/test_indicators.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F401)

tests/test_indicators.py:229:76: F401 `djangocms_versioning.indicators.content_indicator_menu` imported but unused

Check failure on line 229 in tests/test_indicators.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F401)

tests/test_indicators.py:229:76: F401 `djangocms_versioning.indicators.content_indicator_menu` imported but unused

content_indicator(version.content)

0 comments on commit a3898e1

Please sign in to comment.