Converted auth test to use subTest().

This commit is contained in:
Carlton Gibson 2019-08-29 10:58:24 +02:00
parent d275fd04f3
commit 57b9604451
1 changed files with 12 additions and 8 deletions

View File

@ -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"