mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #30066 -- Enabled super user creation without email and password
This commit is contained in:
parent
57b9604451
commit
b5a5c92c72
4 changed files with 25 additions and 8 deletions
|
@ -73,6 +73,22 @@ class BasicTestCase(TestCase):
|
|||
self.assertTrue(super.is_active)
|
||||
self.assertTrue(super.is_staff)
|
||||
|
||||
def test_superuser_no_email_or_password(self):
|
||||
cases = [
|
||||
{},
|
||||
{'email': ''},
|
||||
{'email': None},
|
||||
{'password': None},
|
||||
]
|
||||
for i, kwargs in enumerate(cases):
|
||||
with self.subTest(**kwargs):
|
||||
superuser = User.objects.create_superuser(
|
||||
'super{}'.format(i),
|
||||
**kwargs
|
||||
)
|
||||
self.assertEqual(superuser.email, '')
|
||||
self.assertFalse(superuser.has_usable_password())
|
||||
|
||||
def test_get_user_model(self):
|
||||
"The current user model can be retrieved"
|
||||
self.assertEqual(get_user_model(), User)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue