Skip to content

Commit

Permalink
Same test but simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Sep 22, 2024
1 parent 99715af commit 9d60a75
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions tests/test_toolbars.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,13 +624,11 @@ def test_toolbar_only_catches_page_content_objects(self):

version = PollVersionFactory() # Not a page content model
page = PageFactory() # Get a page, e.g. where an apphook is configured
request_toolbar = get_toolbar(
version.content, edit_mode=True, toolbar_class=VersioningPageToolbar, current_page=page
)

for toolbar in request_toolbar.toolbar.toolbars.values():
if hasattr(toolbar, "page_content"):
# Did page get detected? Otherwise, page_content never will be detected
self.assertIs(toolbar.page, page)
self.assertNotIsInstance(toolbar.page_content, version.content.__class__) # Regression
self.assertIsNone(toolbar.page_content) # Correct result
toolbar = get_toolbar(version.content, edit_mode=True, toolbar_class=VersioningPageToolbar, current_page=page)

# Did page get detected? Otherwise, page_content never will be detected
self.assertIs(toolbar.page, page)
# Check regression does not happen
self.assertNotIsInstance(toolbar.page_content, version.content.__class__)
# Check for correct result
self.assertIsNone(toolbar.page_content)

0 comments on commit 9d60a75

Please sign in to comment.