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))
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)