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): def test_user_no_email(self):
"Users can be created without an email" "Users can be created without an email"
u = User.objects.create_user('testuser1') cases = [
self.assertEqual(u.email, '') {},
{'email': ''},
u2 = User.objects.create_user('testuser2', email='') {'email': None},
self.assertEqual(u2.email, '') ]
for i, kwargs in enumerate(cases):
u3 = User.objects.create_user('testuser3', email=None) with self.subTest(**kwargs):
self.assertEqual(u3.email, '') u = User.objects.create_user(
'testuser{}'.format(i),
**kwargs
)
self.assertEqual(u.email, '')
def test_superuser(self): def test_superuser(self):
"Check the creation and properties of a superuser" "Check the creation and properties of a superuser"