tests: Remove deprecated SHA1PasswordHasher.

SHA1PasswordHasher will be removed in Django 5.1.  MD5PasswordHasher
will remain for the purpose of speeding up tests.

Followup to commit ac5161f439 (#29620).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-07-16 12:34:59 -07:00 committed by Tim Abbott
parent 90701978d9
commit 8843f9f62a
3 changed files with 6 additions and 7 deletions

View File

@ -367,15 +367,15 @@ class AuthBackendTest(ZulipTestCase):
user_profile = self.example_user("hamlet")
password = "a_password_of_22_chars"
with self.settings(PASSWORD_HASHERS=("django.contrib.auth.hashers.SHA1PasswordHasher",)):
with self.settings(PASSWORD_HASHERS=("django.contrib.auth.hashers.MD5PasswordHasher",)):
user_profile.set_password(password)
user_profile.save()
with (
self.settings(
PASSWORD_HASHERS=(
"django.contrib.auth.hashers.PBKDF2PasswordHasher",
"django.contrib.auth.hashers.MD5PasswordHasher",
"django.contrib.auth.hashers.SHA1PasswordHasher",
),
PASSWORD_MIN_LENGTH=30,
),
@ -5040,15 +5040,15 @@ class FetchAPIKeyTest(ZulipTestCase):
user_profile = self.example_user("hamlet")
password = "a_password_of_22_chars"
with self.settings(PASSWORD_HASHERS=("django.contrib.auth.hashers.SHA1PasswordHasher",)):
with self.settings(PASSWORD_HASHERS=("django.contrib.auth.hashers.MD5PasswordHasher",)):
user_profile.set_password(password)
user_profile.save()
with (
self.settings(
PASSWORD_HASHERS=(
"django.contrib.auth.hashers.PBKDF2PasswordHasher",
"django.contrib.auth.hashers.MD5PasswordHasher",
"django.contrib.auth.hashers.SHA1PasswordHasher",
),
PASSWORD_MIN_LENGTH=30,
),

View File

@ -967,15 +967,15 @@ class LoginTest(ZulipTestCase):
user_profile = self.example_user("hamlet")
password = "a_password_of_22_chars"
with self.settings(PASSWORD_HASHERS=("django.contrib.auth.hashers.SHA1PasswordHasher",)):
with self.settings(PASSWORD_HASHERS=("django.contrib.auth.hashers.MD5PasswordHasher",)):
user_profile.set_password(password)
user_profile.save()
with (
self.settings(
PASSWORD_HASHERS=(
"django.contrib.auth.hashers.PBKDF2PasswordHasher",
"django.contrib.auth.hashers.MD5PasswordHasher",
"django.contrib.auth.hashers.SHA1PasswordHasher",
),
PASSWORD_MIN_LENGTH=30,
),

View File

@ -419,7 +419,6 @@ if DEVELOPMENT:
# PRODUCTION. Saves a bunch of time.
PASSWORD_HASHERS = [
"django.contrib.auth.hashers.MD5PasswordHasher",
"django.contrib.auth.hashers.SHA1PasswordHasher",
"django.contrib.auth.hashers.PBKDF2PasswordHasher",
]
# Also we auto-generate passwords for the default users which you