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

def test_user_cant_edit_plugin(self):

    page = self.get_permissions_test_page()
    staff_user = self.get_staff_user_with_no_permissions()
    plugin = self._add_plugin_to_page(page)
    endpoint = self.get_change_plugin_uri(plugin)
    self.add_permission(staff_user, 'change_page')
    self.add_permission(staff_user, 'change_link')
    self.add_global_permission(staff_user, can_change=False)
    with self.login_user_context(staff_user):
        data = model_to_dict(plugin, fields=['name', 'external_link'])
        data['name'] = 'A    link    2'
        response = self.client.post(endpoint, data)
        self.assertEqual(response.status_code, 403)
        plugin.refresh_from_db()
        self.assertNotEqual(plugin.name, data['name'])
