summaryrefslogtreecommitdiff
path: root/tests/admin_views/test_nav_sidebar.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/admin_views/test_nav_sidebar.py')
-rw-r--r--tests/admin_views/test_nav_sidebar.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/tests/admin_views/test_nav_sidebar.py b/tests/admin_views/test_nav_sidebar.py
index 2225376cd5..9d52c541c0 100644
--- a/tests/admin_views/test_nav_sidebar.py
+++ b/tests/admin_views/test_nav_sidebar.py
@@ -51,9 +51,31 @@ class AdminSidebarTests(TestCase):
self.assertNotContains(response, '<nav class="sticky" id="nav-sidebar">')
def test_sidebar_aria_current_page(self):
- response = self.client.get(reverse('test_with_sidebar:auth_user_changelist'))
+ url = reverse('test_with_sidebar:auth_user_changelist')
+ response = self.client.get(url)
self.assertContains(response, '<nav class="sticky" id="nav-sidebar">')
- self.assertContains(response, 'aria-current="page">Users</a>')
+ self.assertContains(response, '<a href="%s" aria-current="page">Users</a>' % url)
+
+ @override_settings(
+ TEMPLATES=[{
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ }]
+ )
+ def test_sidebar_aria_current_page_missing_without_request_context_processor(self):
+ url = reverse('test_with_sidebar:auth_user_changelist')
+ response = self.client.get(url)
+ self.assertContains(response, '<nav class="sticky" id="nav-sidebar">')
+ # Does not include aria-current attribute.
+ self.assertContains(response, '<a href="%s">Users</a>' % url)
+ self.assertNotContains(response, 'aria-current')
@override_settings(ROOT_URLCONF='admin_views.test_nav_sidebar')