예제 #1
0
 def test_invalid_user_has_no_permission(self, user):
     request = RequestFactory().get('/')
     request.user = user
     permission = permissions.IsSuperuser()
     self.assertFalse(permission.has_permission(request, None))
예제 #2
0
 def test_superuser_has_permission(self, has_permission):
     request = RequestFactory().get('/')
     request.user = factories.UserFactory(is_superuser=has_permission)
     permission = permissions.IsSuperuser()
     self.assertEqual(permission.has_permission(request, None),
                      has_permission)