summaryrefslogtreecommitdiff
path: root/tests/auth_tests
diff options
context:
space:
mode:
authorsanjeevholla26 <sanjeevholla26@gmail.com>2024-08-30 23:44:32 +0530
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-09-02 15:19:33 +0200
commit387475c5b2f1aa32103dbe21cb281d3b35165a0c (patch)
treec239d02a75de21531ef368e08e68ae05f68ac75a /tests/auth_tests
parente4a2e22ddbf1b892144b35dc21404c164bc848c6 (diff)
Refs #35706 -- Prefixed 'Error:' to titles of admin pages with form errors.
This improves the screen reader experience.
Diffstat (limited to 'tests/auth_tests')
-rw-r--r--tests/auth_tests/test_templates.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auth_tests/test_templates.py b/tests/auth_tests/test_templates.py
index ceecfa3325..edde6ca6b4 100644
--- a/tests/auth_tests/test_templates.py
+++ b/tests/auth_tests/test_templates.py
@@ -37,6 +37,12 @@ class AuthTemplateTests(TestCase):
)
self.assertContains(response, "<h1>Password reset</h1>")
+ def test_password_reset_view_error_title(self):
+ response = self.client.post(reverse("password_reset"), {})
+ self.assertContains(
+ response, "<title>Error: Password reset | Django site admin</title>"
+ )
+
def test_password_reset_done_view(self):
response = PasswordResetDoneView.as_view()(self.request)
self.assertContains(
@@ -77,6 +83,19 @@ class AuthTemplateTests(TestCase):
'<input class="hidden" autocomplete="username" value="jsmith">',
)
+ def test_password_reset_confirm_view_error_title(self):
+ client = PasswordResetConfirmClient()
+ default_token_generator = PasswordResetTokenGenerator()
+ token = default_token_generator.make_token(self.user)
+ uidb64 = urlsafe_base64_encode(str(self.user.pk).encode())
+ url = reverse(
+ "password_reset_confirm", kwargs={"uidb64": uidb64, "token": token}
+ )
+ response = client.post(url, {})
+ self.assertContains(
+ response, "<title>Error: Enter new password | Django site admin</title>"
+ )
+
@override_settings(AUTH_USER_MODEL="auth_tests.CustomUser")
def test_password_reset_confirm_view_custom_username_hint(self):
custom_user = CustomUser.custom_objects.create_user(