1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00
django/tests/admin_views/test_breadcrumbs.py
Mariusz Felisiak 9440f6ba41
Fixed #34512 -- Restored breadcrumbs on admin app index view.
Thanks Adam (ataylor32) for the report.

Regression in 872b61193b.
2023-04-26 08:36:56 +02:00

30 lines
1.0 KiB
Python

from django.contrib.auth.models import User
from django.test import TestCase, override_settings
from django.urls import reverse
@override_settings(ROOT_URLCONF="admin_views.urls")
class AdminBreadcrumbsTests(TestCase):
@classmethod
def setUpTestData(cls):
cls.superuser = User.objects.create_superuser(
username="super",
password="secret",
email="super@example.com",
)
def setUp(self):
self.client.force_login(self.superuser)
def test_breadcrumbs_absent(self):
response = self.client.get(reverse("admin:index"))
self.assertNotContains(response, '<nav aria-label="Breadcrumbs">')
def test_breadcrumbs_present(self):
response = self.client.get(reverse("admin:auth_user_add"))
self.assertContains(response, '<nav aria-label="Breadcrumbs">')
response = self.client.get(
reverse("admin:app_list", kwargs={"app_label": "auth"})
)
self.assertContains(response, '<nav aria-label="Breadcrumbs">')