summaryrefslogtreecommitdiff
path: root/tests/auth_tests
diff options
context:
space:
mode:
authorCiaran McCormick <ciaran@ciaranmccormick.com>2022-06-02 14:40:20 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-06-03 07:30:57 +0200
commit286e7d076cfb7b4b0bdfc917de3020e6e89683f6 (patch)
treee23a8e90806daa404a5c2b081f7385f9a57f1a71 /tests/auth_tests
parenta3a1290d47326c3f87824b3cf7ca969cb0d364aa (diff)
downloaddjango-286e7d076cfb7b4b0bdfc917de3020e6e89683f6.tar.gz
Fixed #33764 -- Deprecated BaseUserManager.make_random_password().
Diffstat (limited to 'tests/auth_tests')
-rw-r--r--tests/auth_tests/test_models.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auth_tests/test_models.py b/tests/auth_tests/test_models.py
index 2d75b607bf..01bb7981a4 100644
--- a/tests/auth_tests/test_models.py
+++ b/tests/auth_tests/test_models.py
@@ -18,6 +18,8 @@ from django.db import connection, migrations
from django.db.migrations.state import ModelState, ProjectState
from django.db.models.signals import post_save
from django.test import SimpleTestCase, TestCase, TransactionTestCase, override_settings
+from django.test.utils import ignore_warnings
+from django.utils.deprecation import RemovedInDjango51Warning
from .models import CustomEmailField, IntegerUsernameUser
@@ -164,6 +166,7 @@ class UserManagerTestCase(TransactionTestCase):
is_staff=False,
)
+ @ignore_warnings(category=RemovedInDjango51Warning)
def test_make_random_password(self):
allowed_chars = "abcdefg"
password = UserManager().make_random_password(5, allowed_chars)
@@ -171,6 +174,11 @@ class UserManagerTestCase(TransactionTestCase):
for char in password:
self.assertIn(char, allowed_chars)
+ def test_make_random_password_warning(self):
+ msg = "BaseUserManager.make_random_password() is deprecated."
+ with self.assertWarnsMessage(RemovedInDjango51Warning, msg):
+ UserManager().make_random_password()
+
def test_runpython_manager_methods(self):
def forwards(apps, schema_editor):
UserModel = apps.get_model("auth", "User")