Skip to content

Commit

Permalink
Update test settings
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Mar 12, 2024
1 parent fd77632 commit 9916e64
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
1 change: 0 additions & 1 deletion djangocms_moderation/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
__version__ = "2.1.6"

13 changes: 1 addition & 12 deletions djangocms_moderation/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
)
Expand All @@ -101,7 +100,6 @@ def form_submission(self, obj):
'<a href="{}" target="_blank">{}</a>', 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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -272,7 +269,6 @@ def get_preview_link(self, obj):
object_preview_url,
)


@admin.display(
description=_('Reviewer')
)
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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")
)
Expand All @@ -1238,6 +1230,3 @@ def form_data(self, obj):
for d in data
),
)



2 changes: 2 additions & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -32,6 +33,7 @@

from cms import __version__ as cms_version

Check failure on line 34 in tests/settings.py

View workflow job for this annotation

GitHub Actions / flake8

module level import not at top of file


if cms_version < "4.1.0":
HELPER_SETTINGS["INSTALLED_APPS"].append("djangocms_version_locking")

Expand Down
3 changes: 2 additions & 1 deletion tests/test_monkeypatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9916e64

Please sign in to comment.