kopia lustrzana https://github.com/wagtail/wagtail
rodzic
47848f24ed
commit
6a8c2bcd98
|
@ -42,6 +42,7 @@ Changelog
|
|||
* Fix: On "move page" bulk action, do not prefill the destination with the root page (Stefan Hammer)
|
||||
* Fix: Ensure the default preferred language respects the `WAGTAILADMIN_PERMITTED_LANGUAGES` setting (Sébastien Corbin)
|
||||
* Fix: Ensure there is consistent padding in homepage panels table headers (Aditya (megatrron))
|
||||
* Fix: Prevent redundant calls to context processors when rendering userbar (Ihor Marhitych)
|
||||
* Docs: Add missing `django.contrib.admin` to list of apps in "add to Django project" guide (Mohamed Rabiaa)
|
||||
* Docs: Add tutorial on deploying on Ubuntu to third-party tutorials (Mohammad Fathi Rahman)
|
||||
* Docs: Document that request_or_site is optional on BaseGenericSetting.load (Matt Westcott)
|
||||
|
|
|
@ -66,6 +66,7 @@ We have a new pagination interface for all listing views and most choosers, incl
|
|||
* On "move page" bulk action, do not prefill the destination with the root page (Stefan Hammer)
|
||||
* Ensure the default preferred language respects the `WAGTAILADMIN_PERMITTED_LANGUAGES` setting (Sébastien Corbin)
|
||||
* Ensure there is consistent padding in homepage panels table headers (Aditya (megatrron))
|
||||
* Prevent redundant calls to context processors when rendering userbar (Ihor Marhitych)
|
||||
|
||||
### Documentation
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ from wagtail import hooks
|
|||
from wagtail.admin.userbar import AccessibilityItem
|
||||
from wagtail.coreutils import get_dummy_request
|
||||
from wagtail.models import PAGE_TEMPLATE_VAR, Locale, Page, Site
|
||||
from wagtail.test.context_processors import get_call_count, reset_call_count
|
||||
from wagtail.test.testapp.models import BusinessChild, BusinessIndex, SimplePage
|
||||
from wagtail.test.utils import WagtailTestUtils
|
||||
from wagtail.users.models import UserProfile
|
||||
|
@ -444,11 +445,13 @@ class TestUserbarInPageServe(WagtailTestUtils, TestCase):
|
|||
self.homepage.add_child(instance=self.page)
|
||||
|
||||
def test_userbar_rendered(self):
|
||||
reset_call_count()
|
||||
response = self.page.serve(self.request)
|
||||
response.render()
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, '<template id="wagtail-userbar-template">')
|
||||
self.assertEqual(get_call_count(), 1)
|
||||
|
||||
def test_userbar_anonymous_user_cannot_see(self):
|
||||
self.request.user = AnonymousUser()
|
||||
|
|
|
@ -15,9 +15,7 @@ class BaseItem:
|
|||
return {"self": self, "request": request}
|
||||
|
||||
def render(self, request):
|
||||
return render_to_string(
|
||||
self.template, self.get_context_data(request), request=request
|
||||
)
|
||||
return render_to_string(self.template, self.get_context_data(request))
|
||||
|
||||
|
||||
class AdminItem(BaseItem):
|
||||
|
|
|
@ -7,3 +7,22 @@ def do_not_use_static_url(request):
|
|||
return {
|
||||
"STATIC_URL": lambda: exception(),
|
||||
}
|
||||
|
||||
|
||||
CALL_COUNT = 0
|
||||
|
||||
|
||||
def count_calls(request):
|
||||
global CALL_COUNT
|
||||
CALL_COUNT += 1
|
||||
return {}
|
||||
|
||||
|
||||
def get_call_count():
|
||||
global CALL_COUNT
|
||||
return CALL_COUNT
|
||||
|
||||
|
||||
def reset_call_count():
|
||||
global CALL_COUNT
|
||||
CALL_COUNT = 0
|
||||
|
|
|
@ -101,6 +101,7 @@ TEMPLATES = [
|
|||
"django.template.context_processors.request",
|
||||
"wagtail.test.context_processors.do_not_use_static_url",
|
||||
"wagtail.contrib.settings.context_processors.settings",
|
||||
"wagtail.test.context_processors.count_calls",
|
||||
],
|
||||
"debug": True, # required in order to catch template errors
|
||||
},
|
||||
|
|
Ładowanie…
Reference in New Issue