mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #28591 -- Added an error message for createsuperuser --username= (blank).
This commit is contained in:
parent
22ff4f81b1
commit
6aec130a4c
2 changed files with 20 additions and 1 deletions
|
@ -523,6 +523,22 @@ class CreatesuperuserManagementCommandTestCase(TestCase):
|
|||
|
||||
test(self)
|
||||
|
||||
def test_blank_username(self):
|
||||
"""Creation fails if --username is blank."""
|
||||
new_io = StringIO()
|
||||
|
||||
def test(self):
|
||||
with self.assertRaisesMessage(CommandError, 'Username cannot be blank.'):
|
||||
call_command(
|
||||
'createsuperuser',
|
||||
username='',
|
||||
stdin=MockTTY(),
|
||||
stdout=new_io,
|
||||
stderr=new_io,
|
||||
)
|
||||
|
||||
test(self)
|
||||
|
||||
def test_invalid_username(self):
|
||||
"""Creation fails if the username fails validation."""
|
||||
user_field = User._meta.get_field(User.USERNAME_FIELD)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue