Exemplo n.º 1
0
 def test_moderator(self):
     user = self.create_user(username='******',
                             email='*****@*****.**',
                             password='******')
     editors = Group.objects.get(name='Moderators')
     user.groups.add(editors)
     self.assertTrue(user_has_any_page_permission(user))
Exemplo n.º 2
0
 def test_no_permissions(self):
     user = self.create_user(
         username='******', email='*****@*****.**', password='******')
     user.user_permissions.add(
         Permission.objects.get(content_type__app_label='wagtailadmin', codename='access_admin')
     )
     self.assertFalse(user_has_any_page_permission(user))
Exemplo n.º 3
0
 def test_moderator(self):
     user = self.create_user(
         username="******", email="*****@*****.**", password="******"
     )
     editors = Group.objects.get(name="Moderators")
     user.groups.add(editors)
     self.assertTrue(user_has_any_page_permission(user))
Exemplo n.º 4
0
 def test_no_permissions(self):
     user = self.create_user(username="******", email="*****@*****.**", password="******")
     user.user_permissions.add(
         Permission.objects.get(
             content_type__app_label="wagtailadmin", codename="access_admin"
         )
     )
     self.assertFalse(user_has_any_page_permission(user))
Exemplo n.º 5
0
 def is_shown(self, request):
     return user_has_any_page_permission(request.user)
Exemplo n.º 6
0
 def test_inactive_superuser(self):
     user = self.create_superuser(
         username='******', email='*****@*****.**', password='******')
     user.is_active = False
     self.assertFalse(user_has_any_page_permission(user))
Exemplo n.º 7
0
 def test_superuser(self):
     user = self.create_superuser(
         username='******', email='*****@*****.**', password='******')
     self.assertTrue(user_has_any_page_permission(user))
 def setUp(self):
     self.user = self.login()
     self.assertFalse(user_has_any_page_permission(self.user))
Exemplo n.º 9
0
 def test_inactive_superuser(self):
     user = self.create_superuser(
         username="******", email="*****@*****.**", password="******"
     )
     user.is_active = False
     self.assertFalse(user_has_any_page_permission(user))
Exemplo n.º 10
0
 def test_superuser(self):
     user = self.create_superuser(
         username="******", email="*****@*****.**", password="******"
     )
     self.assertTrue(user_has_any_page_permission(user))