mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-30 01:46:24 +01:00
parent
d4e036a67e
commit
100d213b00
@ -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)
|
||||
|
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user