Converted auth test to use subTest().
This commit is contained in:
parent
d275fd04f3
commit
57b9604451
|
@ -53,14 +53,18 @@ class BasicTestCase(TestCase):
|
|||
|
||||
def test_user_no_email(self):
|
||||
"Users can be created without an email"
|
||||
u = User.objects.create_user('testuser1')
|
||||
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, '')
|
||||
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, '')
|
||||
|
||||
def test_superuser(self):
|
||||
"Check the creation and properties of a superuser"
|
||||
|
|
Loading…
Reference in New Issue