diff --git a/tests/test_toolbars.py b/tests/test_toolbars.py index 2e32fa24..e4674560 100644 --- a/tests/test_toolbars.py +++ b/tests/test_toolbars.py @@ -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)