summaryrefslogtreecommitdiff
path: root/tests/auth_tests
diff options
context:
space:
mode:
authorMateo Radman <48420316+mateoradman@users.noreply.github.com>2021-06-20 20:16:33 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-06-25 06:55:47 +0200
commit8a7ac78b706797a03d26b88eddb9d1067ed35b66 (patch)
treedbba445b3fe90377ffae9e4c605beb0ecb3ae93a /tests/auth_tests
parent64839512a6ed04a29e49e246acf8337b1be2cb8e (diff)
Refs #32508 -- Raised ImproperlyConfigured/TypeError instead of using "assert" in various code.
Diffstat (limited to 'tests/auth_tests')
-rw-r--r--tests/auth_tests/test_views.py6
-rw-r--r--tests/auth_tests/urls.py1
2 files changed, 7 insertions, 0 deletions
diff --git a/tests/auth_tests/test_views.py b/tests/auth_tests/test_views.py
index 0ec3a134c2..9ae7dab252 100644
--- a/tests/auth_tests/test_views.py
+++ b/tests/auth_tests/test_views.py
@@ -23,6 +23,7 @@ from django.contrib.contenttypes.models import ContentType
from django.contrib.sessions.middleware import SessionMiddleware
from django.contrib.sites.requests import RequestSite
from django.core import mail
+from django.core.exceptions import ImproperlyConfigured
from django.db import connection
from django.http import HttpRequest, HttpResponse
from django.middleware.csrf import CsrfViewMiddleware, get_token
@@ -386,6 +387,11 @@ class PasswordResetTest(AuthViewsTestCase):
response = Client().get('/reset/%s/set-password/' % uuidb64)
self.assertContains(response, 'The password reset link was invalid')
+ def test_missing_kwargs(self):
+ msg = "The URL path must contain 'uidb64' and 'token' parameters."
+ with self.assertRaisesMessage(ImproperlyConfigured, msg):
+ self.client.get('/reset/missing_parameters/')
+
@override_settings(AUTH_USER_MODEL='auth_tests.CustomUser')
class CustomUserPasswordResetTest(AuthViewsTestCase):
diff --git a/tests/auth_tests/urls.py b/tests/auth_tests/urls.py
index 044f0da037..70857e866a 100644
--- a/tests/auth_tests/urls.py
+++ b/tests/auth_tests/urls.py
@@ -133,6 +133,7 @@ urlpatterns = auth_urlpatterns + [
post_reset_login_backend='django.contrib.auth.backends.AllowAllUsersModelBackend',
),
),
+ path('reset/missing_parameters/', views.PasswordResetConfirmView.as_view()),
path('password_change/custom/',
views.PasswordChangeView.as_view(success_url='/custom/')),
path('password_change/custom/named/',