mirror of
https://github.com/django/django.git
synced 2024-11-29 22:56:46 +01:00
Removed obsolete test CreatesuperuserManagementCommandTestCase.test_nolocale.
Test was added in 4c934f3921
to verify that
the commend works when locale.getdefaultlocale() doesn't return a locale.
getdefaultlocale() no longer runs at runtime, so the test isn't needed.
This commit is contained in:
parent
6a383f773a
commit
eac1423f9e
@ -1,6 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import locale
|
|
||||||
import sys
|
import sys
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
@ -203,39 +202,6 @@ class CreatesuperuserManagementCommandTestCase(TestCase):
|
|||||||
# created password should be unusable
|
# created password should be unusable
|
||||||
self.assertFalse(u.has_usable_password())
|
self.assertFalse(u.has_usable_password())
|
||||||
|
|
||||||
@mock_inputs({'password': "nopasswd"})
|
|
||||||
def test_nolocale(self):
|
|
||||||
"""
|
|
||||||
Check that createsuperuser does not break when no locale is set. See
|
|
||||||
ticket #16017.
|
|
||||||
"""
|
|
||||||
|
|
||||||
old_getdefaultlocale = locale.getdefaultlocale
|
|
||||||
try:
|
|
||||||
# Temporarily remove locale information
|
|
||||||
locale.getdefaultlocale = lambda: (None, None)
|
|
||||||
|
|
||||||
# Call the command in this new environment
|
|
||||||
call_command(
|
|
||||||
"createsuperuser",
|
|
||||||
interactive=True,
|
|
||||||
username="nolocale@somewhere.org",
|
|
||||||
email="nolocale@somewhere.org",
|
|
||||||
verbosity=0,
|
|
||||||
stdin=MockTTY(),
|
|
||||||
)
|
|
||||||
|
|
||||||
except TypeError:
|
|
||||||
self.fail("createsuperuser fails if the OS provides no information about the current locale")
|
|
||||||
|
|
||||||
finally:
|
|
||||||
# Re-apply locale information
|
|
||||||
locale.getdefaultlocale = old_getdefaultlocale
|
|
||||||
|
|
||||||
# If we were successful, a user should have been created
|
|
||||||
u = User.objects.get(username="nolocale@somewhere.org")
|
|
||||||
self.assertEqual(u.email, 'nolocale@somewhere.org')
|
|
||||||
|
|
||||||
@mock_inputs({
|
@mock_inputs({
|
||||||
'password': "nopasswd",
|
'password': "nopasswd",
|
||||||
'u\u017eivatel': 'foo', # username (cz)
|
'u\u017eivatel': 'foo', # username (cz)
|
||||||
|
Loading…
Reference in New Issue
Block a user