'User can\'t copy a plugin if he does not have
change permissions on the model attached to the placeholder
and/or does not have add permissions on the plugin model.'

def test_user_cant_copy_plugin(self):

    staff_user = self._staff_user
    placeholder = self._obj.placeholder
    plugin = self._add_plugin_to_placeholder(placeholder)
    endpoint = self.get_copy_plugin_uri(plugin, container=Example1)
    source_placeholder = plugin.placeholder
    target_placeholder = self._get_example_obj().placeholder
    data = {'source_plugin_id': plugin.pk, 'source_placeholder_id': source_placeholder.pk, 'source_language': plugin.language, 'target_language': 'en', 'target_placeholder_id': target_placeholder.pk}
    self.add_permission(staff_user, 'add_example1')
    self.add_permission(staff_user, 'delete_example1')
    self.add_permission(staff_user, 'add_link')
    with self.login_user_context(staff_user):
        response = self.client.post(endpoint, data)
        self.assertEqual(response.status_code, 403)
        self.assertTrue(source_placeholder.get_plugins('en').filter(pk=plugin.pk).exists())
        self.assertFalse(target_placeholder.get_plugins('en').filter(plugin_type=plugin.plugin_type).exists())
    self.add_permission(staff_user, 'change_example1')
    self.remove_permission(staff_user, 'add_link')
    with self.login_user_context(staff_user):
        response = self.client.post(endpoint, data)
        self.assertEqual(response.status_code, 403)
        self.assertTrue(source_placeholder.get_plugins('en').filter(pk=plugin.pk).exists())
        self.assertFalse(target_placeholder.get_plugins('en').filter(plugin_type=plugin.plugin_type).exists())
