Coverage for app_user/tests.py: 100%
24 statements
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-05 00:53 +0000
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-05 00:53 +0000
1from django.test import TestCase
3from app_user.models import User
6class UserTestCase(TestCase):
7 def test_create_superuser(self):
8 self.assertIs(User.objects.exists(), False)
9 superuser = User.objects.create_superuser('superuser')
10 self.assertEquals(User.objects.count(), 1)
12 self.assertIs(superuser.is_superuser, True)
13 self.assertIs(superuser.is_staff, True)
14 self.assertIs(superuser.is_active, True)
16 def test_create_staff(self):
17 self.assertIs(User.objects.exists(), False)
18 staff = User.objects.create_user('staff', is_staff=True)
19 self.assertEquals(User.objects.count(), 1)
21 self.assertIs(staff.is_superuser, False)
22 self.assertIs(staff.is_staff, True)
23 self.assertIs(staff.is_active, True)
25 def test_create_user(self):
26 self.assertIs(User.objects.exists(), False)
27 staff = User.objects.create_user('user')
28 self.assertEquals(User.objects.count(), 1)
30 self.assertIs(staff.is_superuser, False)
31 self.assertIs(staff.is_staff, False)
32 self.assertIs(staff.is_active, True)