Skip to content

Commit 5a8946a

Browse files
committed
test: fix assertion for SnippetAdminTestCase
1 parent 42a61fd commit 5a8946a

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

tests/test_admin.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from django.contrib.sites.models import Site
88
from django.shortcuts import reverse
99
from django.test import RequestFactory, override_settings
10+
from djangocms_versioning.admin import ExtendedIndicatorVersionAdminMixin
1011

1112
try:
1213
from djangocms_versioning.models import Version
@@ -90,13 +91,23 @@ def test_admin_list_display_with_versioning(self):
9091
With versioning enabled, list_display should be populated with both versioning related items, and the
9192
list actions items
9293
"""
93-
from djangocms_versioning.admin import ExtendedVersionAdminMixin
94-
9594
list_display = self.snippet_admin.get_list_display(self.snippet_admin_request)
9695

9796
# Mixins should always come first in the class bases
98-
self.assertEqual(self.snippet_admin.__class__.__bases__, (ExtendedVersionAdminMixin, admin.ModelAdmin))
99-
self.assertEqual(list_display[:-1], ("name", "get_author", "get_modified_date", "get_versioning_state"))
97+
self.assertEqual(
98+
self.snippet_admin.__class__.__bases__,
99+
(ExtendedIndicatorVersionAdminMixin, admin.ModelAdmin),
100+
)
101+
102+
# Verify static fields
103+
self.assertEqual(list_display[:3], ("name", "get_author", "get_modified_date"))
104+
105+
# Verify dynamic indicator
106+
indicator_field = list_display[3]
107+
self.assertTrue(callable(indicator_field), f"{indicator_field} is not callable")
108+
self.assertEqual(indicator_field.__name__, "indicator")
109+
110+
# Verify actions
100111
self.assertEqual(list_display[-1].short_description.lower(), "actions")
101112

102113
def test_admin_uses_form(self):
@@ -228,7 +239,7 @@ def test_admin_form_edit_when_locked(self):
228239
self.assertEqual(Snippet.objects.count(), 1)
229240

230241
@override_settings(DJANGOCMS_SNIPPET_VERSIONING_ENABLED=False)
231-
def test_slug_colomn_should_hyperlinked_with_versioning_disabled(self):
242+
def test_slug_column_should_hyperlinked_with_versioning_disabled(self):
232243
"""
233244
Slug column should be visible and hyperlinked when versioning is disabled
234245
"""

0 commit comments

Comments
 (0)