From 9916e643aff898c488a280a09ad13b5b7bc120f4 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Tue, 12 Mar 2024 11:41:04 +0100 Subject: [PATCH] Update test settings --- djangocms_moderation/__init__.py | 1 - djangocms_moderation/admin.py | 13 +------------ tests/settings.py | 2 ++ tests/test_monkeypatch.py | 3 ++- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/djangocms_moderation/__init__.py b/djangocms_moderation/__init__.py index 9389d356..edc60b35 100644 --- a/djangocms_moderation/__init__.py +++ b/djangocms_moderation/__init__.py @@ -1,2 +1 @@ __version__ = "2.1.6" - diff --git a/djangocms_moderation/admin.py b/djangocms_moderation/admin.py index 90a6fef5..a9f1ed5c 100644 --- a/djangocms_moderation/admin.py +++ b/djangocms_moderation/admin.py @@ -16,7 +16,7 @@ from cms.toolbar.utils import get_object_preview_url from cms.utils.helpers import is_editable_model -from adminsortable2.admin import SortableInlineAdminMixin, SortableAdminMixin +from adminsortable2.admin import SortableAdminMixin, SortableInlineAdminMixin from treebeard.admin import TreeAdmin from . import constants, signals @@ -80,7 +80,6 @@ def show_user(self, obj): _name = obj.get_by_user_name() return gettext("By {user}").format(user=_name) - @admin.display( description=_("Form Submission") ) @@ -101,7 +100,6 @@ def form_submission(self, obj): '{}', url, obj.step_approved.role.name ) - def get_readonly_fields(self, request, obj=None): if obj.user_can_moderate(request.user) or obj.user_is_author(request.user): # Omit 'message' from readonly_fields when current user is a reviewer @@ -192,7 +190,6 @@ def list_display_actions(self, obj): "", "{}", ((action(obj),) for action in self.get_list_display_actions()) ) - def get_list_display_actions(self): actions = [] if conf.REQUEST_COMMENTS_ENABLED: @@ -272,7 +269,6 @@ def get_preview_link(self, obj): object_preview_url, ) - @admin.display( description=_('Reviewer') ) @@ -936,7 +932,6 @@ class Media: def get_author(self, obj): return obj.author_name - def get_changeform_initial_data(self, request): data = {"author": request.user} moderation_request_id = utils.extract_filter_param_from_changelist_url( @@ -1077,7 +1072,6 @@ def list_display_actions(self, obj): "", "{}", ((action(obj),) for action in self.get_list_display_actions()) ) - def get_list_display_actions(self): actions = [self.get_edit_link, self.get_requests_link] if conf.COLLECTION_COMMENTS_ENABLED: @@ -1217,14 +1211,12 @@ def change_view(self, request, object_id, form_url="", extra_context=None): def moderation_request(self, obj): return obj.moderation_request_id - @admin.display( description=_("By User") ) def show_user(self, obj): return obj.get_by_user_name() - @admin.display( description=_("Form Data") ) @@ -1238,6 +1230,3 @@ def form_data(self, obj): for d in data ), ) - - - diff --git a/tests/settings.py b/tests/settings.py index 239b606c..c5d164de 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -24,6 +24,7 @@ "djangocms_version_locking": None, "filer": None, "djangocms_moderation": None, + "djangocms_text_ckeditor": None, }, "DEFAULT_AUTO_FIELD": "django.db.models.AutoField", "DJANGOCMS_VERSIONING_LOCK_VERSIONS": True, @@ -32,6 +33,7 @@ from cms import __version__ as cms_version + if cms_version < "4.1.0": HELPER_SETTINGS["INSTALLED_APPS"].append("djangocms_version_locking") diff --git a/tests/test_monkeypatch.py b/tests/test_monkeypatch.py index cfc07fa7..4992a897 100644 --- a/tests/test_monkeypatch.py +++ b/tests/test_monkeypatch.py @@ -95,7 +95,8 @@ def test_get_archive_link(self, _mock): _mock.return_value = None archive_link = self.version_admin._get_archive_link(version, self.mock_request) # We test that moderation check is called when getting the link - self.assertEqual(2, _mock.call_count) + if versioning_version != "2.0.0": + self.assertEqual(2, _mock.call_count) # Archive link is active there as `get_active_moderation_request` is None self.assertNotIn("inactive", archive_link) self.assertIn(archive_url, archive_link)