Skip to content

Commit

Permalink
fix assert error for cms 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FreemanPancake committed Oct 30, 2024
1 parent 0d37570 commit 5e14400
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@
from djangocms_navigation.compat import CMS_41
from .utils import UsefulAssertsMixin, disable_versioning_for_navigation

versioning_substr = ""
if CMS_41:
from cms.api import create_page_content # noqa: F401
else:
from cms.api import create_title as create_page_content # noqa: F401
versioning_substr = "-versioning"


class MenuItemChangelistTestCase(CMSTestCase):
Expand Down Expand Up @@ -227,14 +229,15 @@ def test_list_display_without_version_locking(self):
list_display[0:4],
["title", "get_author", "get_modified_date", "get_versioning_state"]
)
self.assertIn("cms-action-btn", list_display[-1])

self.assertIn(f"cms{versioning_substr}-action-btn", list_display[-1])
# The preview button is present
self.assertIn("cms-action-preview", list_display[-1])
self.assertIn(f"cms{versioning_substr}-action-preview", list_display[-1])
# The edit button is present
self.assertIn("cms-action-edit", list_display[-1])
self.assertIn(f"cms{versioning_substr}-action-edit", list_display[-1])
self.assertIn("cms-form-get-method", list_display[-1])
self.assertIn("js-action", list_display[-1])
self.assertIn("js-keep-sideframe", list_display[-1])
self.assertIn(f"js{versioning_substr}-action", list_display[-1])
self.assertIn(f"js{versioning_substr}-keep-sideframe", list_display[-1])

@override_settings(DJANGOCMS_NAVIGATION_VERSIONING_ENABLED=False)
@disable_versioning_for_navigation()
Expand Down Expand Up @@ -2019,7 +2022,7 @@ def test_preview_link(self):
func = self.modeladmin._list_actions(self.get_request("/admin"))
response = func(menu_content)

self.assertIn("cms-action-preview", response)
self.assertIn(f"cms{versioning_substr}-action-preview", response)
self.assertIn('title="Preview"', response)
self.assertIn(preview_endpoint, response)

Expand All @@ -2034,7 +2037,7 @@ def test_edit_link(self):
edit_endpoint = reverse("admin:djangocms_versioning_menucontentversion_edit_redirect", args=(version.pk,),)
response = func(menu_content)

self.assertIn("cms-action-btn", response)
self.assertIn(f"cms{versioning_substr}-action-btn", response)
self.assertIn('title="Edit"', response)
self.assertIn(edit_endpoint, response)

Expand Down Expand Up @@ -2078,7 +2081,7 @@ def test_edit_link(self):
)
response = func(menu_content.root)

self.assertIn("cms-action-btn", response)
self.assertIn(f"cms{versioning_substr}-action-btn", response)
self.assertIn('title="Edit"', response)
self.assertIn(edit_endpoint, response)

Expand Down

0 comments on commit 5e14400

Please sign in to comment.