1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Refs #35402 -- Added tests for invalid usage of submodules in some settings.

This commit is contained in:
Jacob Walls
2024-06-09 12:18:26 -04:00
committed by Sarah Boyce
parent 602fe961e6
commit b99c608ea1
2 changed files with 17 additions and 1 deletions

View File

@@ -14,7 +14,7 @@ from django.contrib.auth.password_validation import (
password_validators_help_texts,
validate_password,
)
from django.core.exceptions import ValidationError
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.db import models
from django.test import SimpleTestCase, TestCase, override_settings
from django.test.utils import isolate_apps
@@ -50,6 +50,15 @@ class PasswordValidationTest(SimpleTestCase):
self.assertEqual(get_password_validators([]), [])
def test_get_password_validators_custom_invalid(self):
validator_config = [{"NAME": "json.tool"}]
msg = (
"The module in NAME could not be imported: json.tool. "
"Check your AUTH_PASSWORD_VALIDATORS setting."
)
with self.assertRaisesMessage(ImproperlyConfigured, msg):
get_password_validators(validator_config)
def test_validate_password(self):
self.assertIsNone(validate_password("sufficiently-long"))
msg_too_short = (