Exemple #1
0
 def test_moderator(self):
     user = get_user_model().objects.create_user(username='******',
                                                 email='*****@*****.**',
                                                 password='******')
     editors = Group.objects.get(name='Moderators')
     user.groups.add(editors)
     self.assertTrue(user_has_any_page_permission(user))
Exemple #2
0
 def test_no_permissions(self):
     user = get_user_model().objects.create_user(username='******',
                                                 email='*****@*****.**',
                                                 password='******')
     user.user_permissions.add(
         Permission.objects.get(content_type__app_label='tuiuiuadmin',
                                codename='access_admin'))
     self.assertFalse(user_has_any_page_permission(user))
 def is_shown(self):
     return user_has_any_page_permission(self.request.user)
Exemple #4
0
 def test_inactive_superuser(self):
     user = get_user_model().objects.create_superuser(
         username='******', email='*****@*****.**', password='******')
     user.is_active = False
     self.assertFalse(user_has_any_page_permission(user))
Exemple #5
0
 def test_superuser(self):
     user = get_user_model().objects.create_superuser(
         username='******', email='*****@*****.**', password='******')
     self.assertTrue(user_has_any_page_permission(user))