'User can\'t edit advanced page settings if he does not
have change permissions on the Page model,
does not have global change permissions and/or
does not have global change advanced settings permissions.'

def test_user_cant_edit_advanced_page_settings(self):

    page = self._permissions_page
    endpoint = self.get_admin_url(Page, 'advanced', page.pk)
    staff_user = self.get_staff_user_with_no_permissions()
    data = self._get_page_data(reverse_id='permissions-2')
    self.add_permission(staff_user, 'change_page')
    page_perm = self.add_page_permission(staff_user, page, can_change=True, can_change_advanced_settings=False)
    with self.login_user_context(staff_user):
        response = self.client.post(endpoint, data)
        self.assertEqual(response.status_code, 403)
        self.assertFalse(self._page_exists(reverse_id='permissions-2'))
    self.remove_permission(staff_user, 'change_page')
    page_perm.can_change = True
    page_perm.save(update_fields=['can_change'])
    with self.login_user_context(staff_user):
        response = self.client.post(endpoint, data)
        self.assertEqual(response.status_code, 403)
        self.assertFalse(self._page_exists(reverse_id='permissions-2'))
