mirror of
https://github.com/django/django.git
synced 2025-10-29 08:36:09 +00:00
Fixed #21627 -- Added unicode_literals to changepassword command.
Fixed a crash when executing changepassword command when the user object representation contained non-ASCII characters.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import getpass
|
||||
from optparse import make_option
|
||||
|
||||
|
||||
@@ -82,6 +82,18 @@ class ChangepasswordManagementCommandTestCase(TestCase):
|
||||
with self.assertRaises(CommandError):
|
||||
command.execute("joe", stdout=self.stdout, stderr=self.stderr)
|
||||
|
||||
def test_that_changepassword_command_works_with_nonascii_output(self):
|
||||
"""
|
||||
#21627 -- Executing the changepassword management command should allow
|
||||
non-ASCII characters from the User object representation.
|
||||
"""
|
||||
# 'Julia' with accented 'u':
|
||||
models.User.objects.create_user(username='J\xfalia', password='qwerty')
|
||||
|
||||
command = changepassword.Command()
|
||||
command._get_pass = lambda *args: 'not qwerty'
|
||||
|
||||
command.execute("J\xfalia", stdout=self.stdout)
|
||||
|
||||
@skipIfCustomUser
|
||||
class CreatesuperuserManagementCommandTestCase(TestCase):
|
||||
|
||||
Reference in New Issue
Block a user