diff options
| author | Christophe Mehay <cmehay@student.42.fr> | 2018-03-01 15:26:40 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-03-02 11:48:43 -0500 |
| commit | e91ff6e29cfd916afd3620adf4aeab733e06dbb5 (patch) | |
| tree | 8d224a65b44855b19753365eac06d94d79435b9f /tests | |
| parent | 3cdc88ba5305f8653fdd1afa36ba9d4d83c426bf (diff) | |
[2.0.x] Fixed #29176 -- Fixed AbstractBaseUser.normalize_username() crash if username isn't a string.
Backport of 40bac28faabbacd0875e59455cd80fb1dbb16966 from master
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/auth_tests/test_models.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auth_tests/test_models.py b/tests/auth_tests/test_models.py index e546d61c64..9f7d785696 100644 --- a/tests/auth_tests/test_models.py +++ b/tests/auth_tests/test_models.py @@ -12,6 +12,7 @@ from django.core import mail from django.db.models.signals import post_save from django.test import TestCase, override_settings +from .models import IntegerUsernameUser from .models.with_custom_email_field import CustomEmailField @@ -157,6 +158,9 @@ class UserManagerTestCase(TestCase): class AbstractBaseUserTests(TestCase): + def test_normalize_username(self): + self.assertEqual(IntegerUsernameUser().normalize_username(123), 123) + def test_clean_normalize_username(self): # The normalization happens in AbstractBaseUser.clean() ohm_username = 'iamtheā¦' # U+2126 OHM SIGN |
