From a026a8a67da8eb636431a0d1308a17bf98c27d02 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 09:55:56 +0000 Subject: [PATCH] ci: auto fixes from pre-commit hooks for more information, see https://pre-commit.ci --- djangocms_alias/cms_plugins.py | 6 +++--- djangocms_alias/cms_toolbars.py | 4 +++- djangocms_alias/forms.py | 6 +++--- tests/test_admin.py | 12 +++++++++--- tests/test_cms_plugins.py | 6 +++--- tests/test_views.py | 20 +++++++++++++++----- 6 files changed, 36 insertions(+), 18 deletions(-) diff --git a/djangocms_alias/cms_plugins.py b/djangocms_alias/cms_plugins.py index 0149d98..19afddf 100644 --- a/djangocms_alias/cms_plugins.py +++ b/djangocms_alias/cms_plugins.py @@ -52,10 +52,10 @@ def get_extra_plugin_menu_items(cls, request, plugin): if alias_content: plugin_menu_items.append( PluginMenuItem( - _('Edit Alias'), + _("Edit Alias"), get_object_edit_url(alias_content), - action='', - attributes={'cms-icon': 'alias'}, + action="", + attributes={"cms-icon": "alias"}, ), ) diff --git a/djangocms_alias/cms_toolbars.py b/djangocms_alias/cms_toolbars.py index c00413f..773f320 100644 --- a/djangocms_alias/cms_toolbars.py +++ b/djangocms_alias/cms_toolbars.py @@ -194,7 +194,9 @@ def override_language_switcher(self): ) if alias_content: url = get_object_edit_url(alias_content, language=code) - language_menu.add_link_item(name, url=url, active=self.current_lang == code) + language_menu.add_link_item( + name, url=url, active=self.current_lang == code + ) def change_language_menu(self): if self.toolbar.edit_mode_active and isinstance(self.toolbar.obj, AliasContent): diff --git a/djangocms_alias/forms.py b/djangocms_alias/forms.py index 8bd0f80..b246e57 100644 --- a/djangocms_alias/forms.py +++ b/djangocms_alias/forms.py @@ -158,9 +158,9 @@ def save(self): name=self.cleaned_data.get("name"), language=self.cleaned_data.get("language"), ) - if self.cleaned_data.get('replace'): - placeholder = self.cleaned_data.get('placeholder') - plugin = self.cleaned_data.get('plugin') + if self.cleaned_data.get("replace"): + placeholder = self.cleaned_data.get("placeholder") + plugin = self.cleaned_data.get("plugin") source_plugins = None else: placeholder, plugin = None, None diff --git a/tests/test_admin.py b/tests/test_admin.py index fea99c6..77b7b59 100644 --- a/tests/test_admin.py +++ b/tests/test_admin.py @@ -451,9 +451,15 @@ def test_aliascontent_list_view(self): self.assertNotContains(response, "Published") self.assertNotContains(response, "Draft") - aliascontent1_url = get_object_preview_url(alias1.get_content(show_draft_content=True)) - aliascontent2_url = get_object_preview_url(alias2.get_content(show_draft_content=True)) - aliascontent3_url = get_object_preview_url(alias3.get_content(show_draft_content=True)) + aliascontent1_url = get_object_preview_url( + alias1.get_content(show_draft_content=True) + ) + aliascontent2_url = get_object_preview_url( + alias2.get_content(show_draft_content=True) + ) + aliascontent3_url = get_object_preview_url( + alias3.get_content(show_draft_content=True) + ) # when versioning is not enabled, the django admin change form # is used which used links to the aliascontent_change view diff --git a/tests/test_cms_plugins.py b/tests/test_cms_plugins.py index 1ccfe55..ceb65c9 100644 --- a/tests/test_cms_plugins.py +++ b/tests/test_cms_plugins.py @@ -54,9 +54,9 @@ def test_extra_plugin_items_for_alias_plugins(self): self.assertEqual(len(extra_items), 2) first, second = extra_items - self.assertEqual(first.name, 'Edit Alias') + self.assertEqual(first.name, "Edit Alias") self.assertEqual(first.url, get_object_edit_url(alias.get_content())) - self.assertEqual(first.action, '') + self.assertEqual(first.action, "") self.assertEqual(second.name, "Detach Alias") self.assertEqual(second.action, "modal") @@ -99,7 +99,7 @@ def test_extra_plugin_items_with_versioning_checks(self): self.assertEqual(len(extra_items), 1) first = extra_items[0] # We cannot detach alias on undraft page - self.assertEqual(first.name, 'Edit Alias') + self.assertEqual(first.name, "Edit Alias") self.assertEqual(first.url, get_object_edit_url(alias.get_content())) def test_rendering_plugin_on_page(self): diff --git a/tests/test_views.py b/tests/test_views.py index a7c4da3..0541a14 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -1552,7 +1552,9 @@ def test_view_multilanguage(self): if is_versioning_enabled(): # we need to call get_absolute_url on the AliasContent object when versioning is enabled, # otherwise we are taken to the version list url - detail_response = self.client.get(get_object_edit_url(alias.get_content(language="en"))) + detail_response = self.client.get( + get_object_edit_url(alias.get_content(language="en")) + ) else: detail_response = self.client.get(alias.get_absolute_url()) list_response = self.client.get( @@ -1570,9 +1572,13 @@ def test_view_multilanguage(self): if is_versioning_enabled(): # we need to call get_absolute_url on the AliasContent object when versioning is enabled, # otherwise we are taken to the version list url - detail_response = self.client.get(get_object_edit_url(alias_content_de)) + detail_response = self.client.get( + get_object_edit_url(alias_content_de) + ) else: - detail_response = self.client.get(get_object_edit_url(alias.get_content())) + detail_response = self.client.get( + get_object_edit_url(alias.get_content()) + ) list_response = self.client.get( admin_reverse(LIST_ALIAS_URL_NAME), ) @@ -1588,9 +1594,13 @@ def test_view_multilanguage(self): if is_versioning_enabled(): # we need to call get_absolute_url on the AliasContent object when versioning is enabled, # otherwise we are taken to the version list url - detail_response = self.client.get(get_object_edit_url(alias_content_fr)) + detail_response = self.client.get( + get_object_edit_url(alias_content_fr) + ) else: - detail_response = self.client.get(get_object_edit_url(alias.get_content())) + detail_response = self.client.get( + get_object_edit_url(alias.get_content()) + ) list_response = self.client.get( admin_reverse(LIST_ALIAS_URL_NAME), # noqa: E501 )