0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00

Fix page unlock message

Regression in ddbdd51
This commit is contained in:
Sage Abdullah 2022-12-15 09:21:51 +00:00
parent d4e036a67e
commit 100d213b00
No known key found for this signature in database
GPG Key ID: EB1A33CC51CC0217
2 changed files with 16 additions and 4 deletions

View File

@ -2,6 +2,7 @@ from django.contrib.auth.models import Group, Permission
from django.test import TestCase
from django.urls import reverse
from django.utils import timezone
from django.utils.html import escape
from wagtail.models import Page
from wagtail.test.testapp.models import SimplePage
@ -227,6 +228,7 @@ class TestLocking(TestCase, WagtailTestUtils):
response = self.client.post(
reverse("wagtailadmin_pages:unlock", args=(self.child_page.id,)),
{"next": reverse("wagtailadmin_pages:edit", args=(self.child_page.id,))},
follow=True,
)
# Check response
@ -234,6 +236,17 @@ class TestLocking(TestCase, WagtailTestUtils):
response, reverse("wagtailadmin_pages:edit", args=(self.child_page.id,))
)
# Should show unlocked message
self.assertContains(
response, escape("Page 'Hello world! (simple page)' is now unlocked.")
)
# Message shouldn't be wrapped in a tuple
self.assertNotContains(
response,
escape(("Page 'Hello world! (simple page)' is now unlocked.",)),
)
# Check that the page is unlocked
page = Page.objects.get(id=self.child_page.id)
self.assertFalse(page.locked)

View File

@ -33,7 +33,6 @@ class UnlockView(PageOperationViewMixin, lock.UnlockView):
return super().perform_operation()
def get_success_message(self):
return (
_("Page '%(page_title)s' is now unlocked.")
% {"page_title": self.object.get_admin_display_title()},
)
return _("Page '%(page_title)s' is now unlocked.") % {
"page_title": self.object.get_admin_display_title()
}