Converted auth test to use subTest().
This commit is contained in:
parent
d275fd04f3
commit
57b9604451
|
@ -53,15 +53,19 @@ class BasicTestCase(TestCase):
|
|||
|
||||
def test_user_no_email(self):
|
||||
"Users can be created without an email"
|
||||
u = User.objects.create_user('testuser1')
|
||||
cases = [
|
||||
{},
|
||||
{'email': ''},
|
||||
{'email': None},
|
||||
]
|
||||
for i, kwargs in enumerate(cases):
|
||||
with self.subTest(**kwargs):
|
||||
u = User.objects.create_user(
|
||||
'testuser{}'.format(i),
|
||||
**kwargs
|
||||
)
|
||||
self.assertEqual(u.email, '')
|
||||
|
||||
u2 = User.objects.create_user('testuser2', email='')
|
||||
self.assertEqual(u2.email, '')
|
||||
|
||||
u3 = User.objects.create_user('testuser3', email=None)
|
||||
self.assertEqual(u3.email, '')
|
||||
|
||||
def test_superuser(self):
|
||||
"Check the creation and properties of a superuser"
|
||||
super = User.objects.create_superuser('super', 'super@example.com', 'super')
|
||||
|
|
Loading…
Reference in New Issue