'User can copy a placeholder to the clipboard
if he has add permissions on the plugin models
being copied.'

def test_user_can_copy_placeholder_to_clipboard(self):

    staff_user = self._staff_user
    source_placeholder = self._obj.placeholder
    endpoint = self.get_copy_placeholder_uri(source_placeholder, container=Example1)
    self._add_plugin_to_placeholder(source_placeholder, 'StylePlugin')
    self._add_plugin_to_placeholder(source_placeholder, 'LinkPlugin')
    user_settings = UserSettings.objects.create(language='en', user=staff_user, clipboard=Placeholder.objects.create())
    self.add_permission(staff_user, 'add_link')
    self.add_permission(staff_user, 'add_style')
    data = {'source_plugin_id': '', 'source_placeholder_id': source_placeholder.pk, 'source_language': 'en', 'target_language': 'en', 'target_placeholder_id': user_settings.clipboard.pk}
    with self.login_user_context(staff_user):
        response = self.client.post(endpoint, data)
        self.assertEqual(response.status_code, 200)
    clipboard_plugins = user_settings.clipboard.get_plugins()
    self.assertTrue(clipboard_plugins.filter(plugin_type='PlaceholderPlugin').exists())
    self.assertEqual(len(clipboard_plugins), 1)
    placeholder_plugin = clipboard_plugins[0].get_plugin_instance()[0]
    ref_placeholder = placeholder_plugin.placeholder_ref
    self.assertEqual(ref_placeholder.get_plugins().count(), 2)
