'User can\'t delete a page with plugins if he
does not have delete permissions on the Page model,
does not have delete permissions on the plugins
in the page translations, and/or does not have
global delete permissions.'

def test_user_cant_delete_non_empty_page(self):

    page = self.get_permissions_test_page()
    endpoint = self.get_admin_url(Page, 'delete', page.pk)
    staff_user = self.get_staff_user_with_no_permissions()
    self._add_plugin_to_page(page)
    self.add_permission(staff_user, 'change_page')
    self.add_permission(staff_user, 'delete_page')
    gp = self.add_global_permission(staff_user, can_change=True, can_delete=True)
    with self.login_user_context(staff_user):
        data = {'post': 'yes'}
        response = self.client.post(endpoint, data)
        self.assertEqual(response.status_code, 403)
        self.assertTrue(self._page_exists())
    self.remove_permission(staff_user, 'delete_page')
    gp.can_delete = True
    gp.save(update_fields=['can_delete'])
    with self.login_user_context(staff_user):
        data = {'post': 'yes'}
        response = self.client.post(endpoint, data)
        self.assertEqual(response.status_code, 403)
        self.assertTrue(self._page_exists())
