mirror of
https://github.com/django/django.git
synced 2025-10-21 07:42:25 +00:00
Refs #21379 -- Normalized unicode username inputs
This commit is contained in:
parent
526575c641
commit
9935f97cd2
6 changed files with 56 additions and 2 deletions
|
@ -7,6 +7,7 @@ from django.apps import apps
|
|||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.models import AnonymousUser, User
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.db import IntegrityError
|
||||
from django.dispatch import receiver
|
||||
from django.test import TestCase, override_settings
|
||||
from django.test.signals import setting_changed
|
||||
|
@ -60,6 +61,12 @@ class BasicTestCase(TestCase):
|
|||
def test_unicode_username(self):
|
||||
User.objects.create_user('jörg')
|
||||
User.objects.create_user('Григорий')
|
||||
# Two equivalent unicode normalized usernames should be duplicates
|
||||
omega_username = 'iamtheΩ' # U+03A9 GREEK CAPITAL LETTER OMEGA
|
||||
ohm_username = 'iamtheΩ' # U+2126 OHM SIGN
|
||||
User.objects.create_user(ohm_username)
|
||||
with self.assertRaises(IntegrityError):
|
||||
User.objects.create_user(omega_username)
|
||||
|
||||
def test_is_anonymous_authenticated_method_deprecation(self):
|
||||
deprecation_message = (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue