'User can\'t delete page permissions if he
does not have change permissions on the Page model,
does not have delete permissions on the PagePermission model,
does not have global change permission,
and/or does not have global change permissions permission.'

def test_user_cant_delete_page_permissions(self):

    admin = self.get_superuser()
    page = self.get_permissions_test_page()
    endpoint = (self.get_admin_url(Page, 'permissions', page.pk) + '?language=en')
    staff_user = self.get_staff_user_with_no_permissions()
    staff_user_2 = self.get_staff_page_user(created_by=admin)
    permission = self.add_page_permission(user=staff_user_2, page=page)
    data = self._get_page_permissions_data(page=page.pk, user=staff_user_2.pk, id=permission.pk, DELETE='on')
    data['_continue'] = '1'
    self.add_permission(staff_user, 'change_page')
    self.add_permission(staff_user, 'delete_pagepermission')
    self.add_global_permission(staff_user, can_change=True, can_change_permissions=False)
    with self.login_user_context(staff_user):
        response = self.client.post(endpoint, data)
        self.assertEqual(response.status_code, 403)
        self.assertTrue(self._page_permission_exists(user=staff_user_2))
