diff options
| author | Francisco Albarran <pahko.xd@gmail.com> | 2015-06-20 00:15:32 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-06-22 11:34:26 -0400 |
| commit | e75b614640c206bf6d0b1c9d32c54434ea719582 (patch) | |
| tree | 4a711432d3398d2dfc86d910daa6eee5f83a0d10 /tests/auth_tests | |
| parent | 34047b23e284fd3459903294a5776b67c3e33ed9 (diff) | |
Fixed #25009 -- Allowed User.objects.create_user(...,is_staff=True) to work.
Diffstat (limited to 'tests/auth_tests')
| -rw-r--r-- | tests/auth_tests/test_models.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auth_tests/test_models.py b/tests/auth_tests/test_models.py index 62c38ed578..c02414b385 100644 --- a/tests/auth_tests/test_models.py +++ b/tests/auth_tests/test_models.py @@ -165,6 +165,27 @@ class UserManagerTestCase(TestCase): User.objects.create_user, username='' ) + def test_create_user_is_staff(self): + email = 'normal@normal.com' + user = User.objects.create_user('user', email, is_staff=True) + self.assertEqual(user.email, email) + self.assertEqual(user.username, 'user') + self.assertTrue(user.is_staff) + + def test_create_super_user_raises_error_on_false_is_superuser(self): + with self.assertRaisesMessage(ValueError, 'Superuser must have is_superuser=True.'): + User.objects.create_superuser( + username='test', email='test@test.com', + password='test', is_superuser=False, + ) + + def test_create_superuser_raises_error_on_false_is_staff(self): + with self.assertRaisesMessage(ValueError, 'Superuser must have is_staff=True.'): + User.objects.create_superuser( + username='test', email='test@test.com', + password='test', is_staff=False, + ) + class AbstractUserTestCase(TestCase): def test_email_user(self): |
